Message Filtering
Apple separated spam messages and messages from unknown senders into two categories in iOS 26, and both can be filtered out if you prefer.
There's a Filter section that you can access by tapping the icon at the top right of the Messages app interface that will let you see messages with specific content. Options include Unknown Senders, Transactions, Promotions, Spam, and Recently Deleted.
You can have messages from unknown senders (aka not saved in your Contacts) sent directly to the Unknown Senders list, and you won't get notifications. You'll see a badge in the filter section of the Messages app so you know the message is there, but you won't be bothered by it.
There's an exception you can turn on for Time Sensitive notifications, so you won't miss something like a food delivery person sending you a message. Messages classified as spam will be sent to the spam box, and you won't see a notification or a badge.
You can also turn on filtering notifications for messages that are classified as Personal (not from businesses), Transactions (order receipts and confirmations), and Promotions.