Thanks for posting your query.
It seems to be cervical strain or muscle pull.
I advice you to give rest to your neck. You can take non-steroidal anti-inflammatory drugs (NSAIDs) like motrin
to reduce inflammation and pain; muscle relaxants to calm spasm.
If it persist after that , get examined by an orthopaedician and treatment plan according to that.
Dr Saurabh Gupta