Hi Hamish,
I joined the apple community to specifically answer this question because it was annoying me so much. My iPhone X started to display the same issue. A soft/hard rest fixes the problem but only temporarily.
Once my phone entered it's 'not going to sleep on lock screen' mode I noticed something else strange occurring. When using Spotify or iTunes, my phone's music would stop whenever I pressed the sleep/wake button or if the phone went onto standby by itself while Spotify was open. This is not usual behaviour as obviously the music never usually stops when the screen is turned off.
After a bit of digging into similar 'music stopping' situations, this seems to happen on both iPhone X and iPhone 8 devices and it appears related to apple pay. I don't use apple pay personally, but I have a sticky bank tag on my phone cover right where the NFC chip is which I use for credit card payments. It uses it's own NFC chip. But whenever I payed for something with my bank tag, the screen would light up and 'notify' me to try using apple pay. After that, phone enters 'not going to sleep on lock screen' mode and music would stop playing when pressing the sleep/button. Only option after that is to reset the phone.
The one thing that worked for me was to disable the notifications from Wallet (and therefore apple pay). I haven't had a problem since. Unfortunately, if you do you use apple pay, you might be out of luck with this work around.
I hope this helps you and/or others out there because it frustrated me for weeks.
Best of luck,
Anthony.