First of all, check if you can access via FTP to the server (if installation of security plugins can’t work or you need to recovery website, …). Then try to scan your website – you can use some plugins from link which I already sent. Check the content of .htaccess and remove rules which seem as “malware” (probably at the begin). Try to refresh permalinks – https://www.ads-software.com/support/article/using-permalinks/ (just click on save on Settings/Permalinks).
You can install plugin https://www.ads-software.com/support/article/using-permalinks/ to check some stuff related to the server. Also, there is option to check “File Integrity”.
Also, it’s out of topic because it isn’t directly related to Yoast SEO plugin. Please ask for additional help on other forums (eg. Fixing WordPress).