To be honest I think Yoast is a world class spammer which always annoyed me. So I quit using his products long time ago.
I never heard of RankMath before so i cannot tell much about it. I did look a bit on their website, and it looks interesting, but is all I can comment on it obviously.
Currently I´m using WPMU Dev’s SmartCrawl Pro which I’m quite satisfied with so far. https://premium.wpmudev.org/project/smartcrawl-wordpress-seo/
However SmartCrawl its a premium product so it is not free.
They have free version on wordpress.org though.