Hi as per question it may be neck sprain due to wrong sleeping/working posture or any exercise plz. Check if the pain is not traveling down till fingers.
Next Steps
Do ice pack & apply some pain relief ointment & wait till 72 hrs(3days).
Health Tips
if pain not better then visit near by doctor or come online in private session..