Just as there is not one position that is best for sleeping for everyone, there is not one pillow that is best either - everybody’s preference is very individual. There are many different types of pillows, from very hard to very soft.
Some people find they are more comfortable using a firmer pillow, whereas for others a soft pillow is better, and sometimes more than one is good. Use whatever pillow you find the most comfortable and which allows you to get more uninterrupted sleep - the amount and quality of sleep you get is far more important than the position in which you sleep.
Holding the neck in a neutral position while sleeping is typically the most comfortable position when it comes to sleeping with neck pain. This means your neck is not very high, very low or side bent in comparison to the rest of your body. You may be asking, if alignment is important, does that mean I can’t sleep on my stomach?
Sure you can. The general rule of thumb is that if it is uncomfortable, change positions. If you find yourself comfortable while sleeping on your stomach than sleep on your stomach! Having the head in line with the spine may be the most comfortable for many, but it doesn't mean its bad or going to cause harm for the neck to not be in "perfect" neutral position.
If you are used to sleeping in the same position, but now find that this is uncomfortable and affecting your sleep, try a different position for some time while you are working on reducing your neck pain with exercises and by remaining physically active at your current load tolerance (see more about that here).
When you start to feel better, try your preferred sleeping position again. This approach of “off-loading” for some time while finding the optimal load through recovery exercises is one that is used for many injuries. For example, if you were running and hurt your knee, you would take a break while your knee heals and pain desensitises. Then you would try something else in the interim and train around the injury, before gradually returning to running while your tolerance to running increases. Well, it's a bit the same with modifying sleeping positions if they are painful, and then returning to them when things improve.
Lastly, don't forget that getting the recommended 7-9 hours of sleep each night is probably way more important when it comes to recovery and pain prevention than what type of pillow you sleep with (see more on that in this blog).