I've also been fighting this notification issue for months on my iPhone 11 Pro. Apple no help. I discovered that turning off bluetooth on my phone fixed the problem (allowed text notifications to sound and appear, whether the phone was locked or not). But with bluetooth on, notifications only sounded & appeared with the phone unlocked. Obviously, I didn't want to leave bluetooth off all the time.
I also came to realize this issue started when I got a new Apple Watch 6 a few months ago. Coincidence? Taking the watch on and off didn't help. And with the watch on, it didn't sound notifications either.
But the posting from StubbornPixie got me thinking about killing the mirror function on the watch for the Messages app. So, iPhone Watch app>Messages>"Custom" "Notifications Off" seems to have SOLVED THE PROBLEM for me. My iPhone 11 Pro now notifies me of incoming text messages with bluetooth on. I realize my watch won't ping with messages until Apple fixes the root problem, but at least I won't be missing message notifications altogether.
Hope this helps others.