Hi. I recently had something similar happen. Phone wasn't making notification sounds for messages, but everything else worked. (iPhone 12 mini)
Double and triple check your DND and Focus mode settings.
Do a forced reset, (Quickly press volume up, volume down, and then press and hold the lock button until you see the Apple logo.)
Once you've exhausted all other avenues, the thing that finally solved my problem (though it made the next day-and-a-half really annoying) was Resetting the phone.
The reset process won't delete any data, though it will remove cards from wallet, and reset all the app settings. (And delete all your alarms and sleep schedule.) So be prepared to allow each and every app you have to ask you for permission to use your photos, camera, mic, location, health data, etc. The phone kind of thinks it's a new install at this point and it prompted me to make a new memoji, and offered tips and tricks... It'll take a bit to get it all back to where you had it.
But, my phone now makes noise again. So hope this helps.