Have you ever had whiplash? This is when the head snaps forward and back and can come about from a car accident, sports accident or just about anything that produces this motion. The result is stiffness, decreased range of motion and pain. What's the best remedy?
Stretching. 3 to 4 times a day rotate the neck from side to side, tilt the head from side to side, move the neck forward toward the chest and backward, and roll the shoulders in circles says the Cleveland Clinic.
And of course, see your doctor if the issues persist.
https://www.medicinenet.com/script/main/art.asp?articlekey=224236