Sometimes due to wrong posture or sudden jerk muscles get strained and it could cause pain to connected parts so see your physiotherapist for proper treatment
Next Steps
Consult a Physio , needs posture correction , basic Rom exercises to neck n shoulder
Health Tips
Avoid sleeping on painful shoulder , you can use ice pack , avoid taking high pillow , take precaution while using mobile , avoid activities which vl put pressure on your neck