Sleeping on back

Am

I do my absolute best to sleep on my side but I am ending up in agony with hip pain at times to the point I can't sleep so I then lie on my back to get some relief and I could fall asleep immediately in that position. I also keep getting restless legs and sometimes the only thing that will relieve it is being on my back with my legs elevated and then I'm so comfortable I could just sleep. Is it really that bad to lie on your back to sleep sometimes? I will obviously try my best not to but I'm ending up so sleep deprived and the baby isn't even here yet 😂

Edit: I've tried maternity pillows and pillows between my legs for side sleeping but I've had ongoing issues with my ligaments in my hips since I was a teen so it just makes it worse at times.