Fastmail supports ( https://www.fastmail.help/hc/en-us/search?utf8=%E2%9C%93&que... ) the Sieve mail filtering language ( https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language )
GMail does not.
About the only thing I liked about Yahoo mail was its built-in blocking feature, which apparently used Sieve without any tap dancing needed. All you had to do was pick an email address to block, block it, and that was it - you'd never get _anything_ from that sender again, and the sender wouldn't know that they'd been blocked, so they wouldn't be tempted to try another route.
But GMail? Duhhh, nope.