Based on your description, please kindly check if set up SPF, DKIM and DMARC for your custom domain in Microsoft 365 completely. Please also make sure if your network bypassed Office 365 URLs and IP address ranges which help to deliver email to yahoo account.
If all configurations are correct, and you only have this issue with Yahoo accounts, based my previous experience, this issue may be caused by that Yahoo had identified Microsoft as "abusive”. This is the issue between Yahoo and Microsoft, instead of your issue.
Some similar thread:
Error 550 5.4.300 and 421 4.4.2 when sending to aol.com email address - Microsoft Q&A
All emails I am attempting to send to Yahoo/Aol accounts are bouncing - Microsoft Community
You could contact Microsoft Support to report this issue: Get support - Microsoft 365 admin | Microsoft Learn