All, I may have stumbled on the cause and fix. I have had this same problem since iOS 11.
Hope this helps others....
Short story:
Try going to Settings --> Bluetooth and disable Bluetooth.
Retest Messages and alerts / sounds come through fine.
Some combination of enabling/disabling BT kills the notifications, read on for more...
Long story:
Initially, it seemed that I could reproduce the problem and the resolution.
Go to Settings --> Touch ID & Passcode, enter your passcode, then scroll down to:
"ALLOW ACCESS WHEN LOCKED":
"Recent Notifications" (I had this unticked)
With this unticked, I get zero alerts when the phone is locked. If I re-tick the "Recent Notifications" toggle, then my Messages alerts/notifications come through just fine.
Or so I thought! This worked a few times, then stopped completely again!
So, I previously had issues with iOS 10.x on my iPhone 6S getting Message notifications when Bluetooth was enabled. So, I almost always left it disabled.
I noticed that with iOS 11 Bluetooth seemed to keep re-enabling itself automatically somehow. So, I kept turning it back off via Control Center.
It appears in iOS 11 however, that turning off Bluetooth via Control Center does NOT actually turn Bluetooth off. It seems more like a soft disable because there is a new message there that says "New Bluetooth connections have been turned off from Control Center". Which is actually kinda cool, but anyways...
With Bluetooth "off" in Control Center and no Bluetooth icon in the top status bar, I then went into Settings --> Bluetooth.
Guess what? Bluetooth is enabled! Disable Bluetooth completely and lock my phone. Send a new text iMessage from another device and voila!, I get the notification pop up and sounds/vibrations. All good!
Some combination of enabling/disabling Bluetooth via Control Center kills the notifications/alerts.
If I re-enable Bluetooth, alerts still come through, but if I disable Bluetooth from Control Center again....alerts are gone again.