Hi mum, I had heartburn during third trimester also and it can feel really scary because sometimes it comes with chest tightness and even discomfort that can spread to the back. So yes, for some mums it can feel like back pain together with the burning sensation, especially at night when lying down makes it worse. But since you mentioned chest tightness and pain that doesn’t improve even when changing position, I would be more careful here. If it feels severe, keeps coming back, or you feel breathless or unwell, better go in and get checked urgently just to be safe, because pregnancy can sometimes overlap different causes and we shouldn’t assume it’s only heartburn.
Please go to A&E now, bad chest tightness and back pain at 31 weeks that wakes you from sleep is not something to wait on. Better to get checked and have it be nothing than to take any chances.