Apple provide blocking feature. You block the call after you received it, after which it will be directly forwarded to voice mail wihtout you knowing it. But I know what you are asking. Above is not a true call blocking in that spam callers still go through to your VM.
What you need, and available in Android, is a true call blocker that literally block unwanted callers the first time. It allso block unknown or private callers, and you can also program wild card
#s using asterisks.
But this requires Apple to give API to developers, who would create call blocking app that lurks in the background.
In the beginning...... Apple did not give API to developers, probabaly because of bettery concern (I think). Apple still do not. But they came a long way to at least eanable # blocking manually.
I used to jailbreak the phone to obtain true call blockers such as iBlacklist etc, but not doing so any more in the last few years, as I no longer need them. I now think it is better Apple way as spammers don't bother me (once blocked) but if you want, you can check who might have called you. This, combined with "Hiya" and "truecaller", both of which have databases of millions of spam
#s , I seldom receive robocalls or spam calls these days. It used to be everyday or many times a day etc. Now it died down to perhaps a couple of times a month? Then, they are immediately blocked anyway.