Thanks for writinng your query.
It seems that you have injured your muscles of your neck resulting in sprain of neck muscles.
Give rest to your injured area. You can apply cold compress locally.
Apply pain relieving gel locally.
If the pain is severe, you take pain killer like Ibuprofen
one tablet twice a day after meals along with an antacid
and a muscle relaxant
If your problem persists, get yourself examined by an orthopedic surgeon.
I hope this is helpful to you.