Hello Bethrg1020,
Thank you for reaching out to Apple Support Communities! It sounds like you've enabled Filter Unknown Senders for iMessages, however you're still receiving text messages from people who are not in your Contacts. You're in the right place to find a resolution.
The feature that you're referring to applies to incoming iMessages specifically. It does not filter SMS/MMS from unknown senders, which is what it sounds like you're still receiving. The "Filter iMessages from unknown senders" section in the resource below provides more information about how this feature works:
Block phone numbers, contacts, and emails on your iPhone, iPad, or iPod touch - Apple Support
You can follow the steps to block, but not filter, phone numbers or contacts instead. This would prevent you from receiving messages from the blocked number or contact. SMS/MMS is a carrier controlled feature so you may also want to check with your carrier to determine if there's additional steps you can take to manage spam messages.
Take care.