iMessage - How to block SMS from contacts without phone numbers? I am sometimes getting SMS messages in iMessage app from empty contacts. Such contact has a name (even it’s not in my contacts), but doesn’t have a phone number or email address. Hence, “Block this Caller” doesn’t work.
Bonus question:
How it is possible that Messages app accepts such SMS messages anyway?
Main question
How to block such SMS messages or enable some option that will prevent SMS without a phone number?
Here is an example of such empty contact. No phone number, no email - “Block” button doesn’t work.
SMS delivery is something your cellular carrier has the most control over. They make money delivering SMS so the trick is to convince them to let you not receive “fake” sms with bogus caller ID. That really varies by carrier and region so once you’re sure you’ve configured you SMS service as you want it, then the iOS settings are next best thing to try.

Contact your carrier - https://support.apple.com/en-us/HT204039
Use Apple settings - https://support.apple.com/en-us/HT201229

Filtering all unknown SMS and using do not disturb work best for me, but you may have to experiment with the controls to find your best mix of getting messages you want, not seeing those you don’t need to see immediately and engaging blocks on ones that are annoying pests.
In the end, you can’t block a number that doesn’t get reported correctly from the carrier or that you don’t know. Apple has a service added to allow third party applications to screen your calls - https://support.apple.com/en-us/HT207099  but this doesn’t (yet) work for potentially screening junk messages.