Hello lorimand,
Thank you for reaching out to Apple Support Communities! It sounds like after turning on Filter Unknown Senders, you still received a message from an unknown sender on your iPhone. You're in the right place to find a resolution.
The feature that you're referring to will only filter iMessages from people who aren't in your contacts, and it will not filter SMS/MMS that you receive from unknown senders:
Block phone numbers, contacts, and emails on your iPhone, iPad, or iPod touch - Apple Support
On the message that you received under the Contacts & SMS tab, do you see a link you can tap on that says Report Junk? If not, that indicates this message was a SMS, so it would not be filtered to the Unknown Senders tab. In that scenario, consider doing one of the following suggestions instead:
"To report SMS and MMS messages, contact your carrier."
If you're in Messages, open the conversation, tap the contact at the top of the conversation, then tap
. Tap the name, phone number or email address, scroll to the bottom of the screen, then tap Block this Caller.
When you block a phone number or contact, they can still leave a voicemail, but you won't get a notification. Messages that are sent or received won't be delivered. Also, the contact won't get a notification that the call or message was blocked. When you block an email address from Mail, it goes to the trash folder. Email blocking works across all your Apple devices."
Take care.