You should always sleep in a relaxed position that does not put pressure on your back and neck, and make sure to keep your spine alignment.
If you sleep on your side, it is vital to use a pillow between your legs to maintain spine alignment, or a pillow under your knees if you sleep on your back.
Sleeping for long hours in the wrong position can have damaging effects on the spine.