If you experience stiffness and pain in your neck when you wake up, it might be because you are not using the right pillow.
Generally, Soft pillows are not suggested. They do not provide proper support to the Head and Neck while sleeping. Therefore, muscles in the neck will slightly contract to provide support instead. This leads to stiffness and tiredness in your neck when waking up.
Thickness of the pillow is important as well. If you mainly sleep on your side, use a thicker pillow, and if mostly sleep on your back, use a thinner pillow. This is to keep you head and neck in a neutral position.
Lastly, when sleeping, make sure that the pillow is snug with your shoulders. There should be no space between the edge of the pillow and the top of your shoulders. This is essential to provide support to your neck as well as your head.