No choice but to look for 3rd party software. Samsung withdrew this option a while ago claiming that it 'occasionally got it wrong' or similar. For me it was the most effective anti spam tool for Messages available.
I've now tried out a few alternatives and despite it looking crap with no dark mode option and unintuitive the
AntiNuisance Call Blocker is proving to be the best substitute. Ignore the baby interface, it does work.
I did try Calls Blacklist and Calls Blacklist Pro which has a better interface and does allow word/phrase blocking unfortunately on my Note 8, despite whatever notification settings I tried, would rarely give a notification for any message so that you had to check it regularly for genuine messages. It might work with other phones though and would normally have been my first choice.
I didn't realise until it had gone how much I relied on the Samsung method of phrase blocking.
My Play Store Review of Calls Blacklist Pro:
'
It does 'block' spam messages and it does block messages that contain a specified phrase. However the novel way it does this...by not notifying you of any messages at all means it only gets 1 star. If you check it every day you'll find your genuine messages but obviously can't be relied on if you get any important messages. I've made sure the Notification is set, that it's specifically not being optimised (Android 9) but still no notifications any message spam or no spam. Still looking for a reliable phrase as well as spam blocker. I'm a bit annoyed I paid for this now.'
Review of AntiNuisance:
'I'm only using this for the phrase blocking options in SMS Messages. This works, however a permanent notification is normally visible at all times (Android 9) unless you use the AutoNotification App to block it. Also the default is to notify of every message blocked fortunately though, this can be switched off in the mainly unintuitive settings. Unfortunately the App design and interface doesn't follow any normal convention except that in the Developers own minds and they certainly have weird minds. In addition there's no option for dark mode so you're stuck with the stock nursery theme. I don't normally subscribe to Apps and I'm not going to subscribe to this one despite its apparent effectiveness unless I see major changes to the look and feel in the next couple of months. The App is certainly a lot different from the version supplied through the Samsung Galaxy Store but it's still miles away from a decent looking and functioning App.'