Hello, thank you for reaching out to Microsoft Q&A.
May I please know if you have any other verification methods, such as a phone number or an Authenticator app, to Verify Your Identity?
If you only have the Yahoo email address to receive the code and this address no longer exists, you will have to replace the Security information in your Microsoft account.
That is, on the Verify Your Identity Screen, select 'I don't have any of these' and follow the prompts to replace the security information.
Note - If you remove all of your previous security information and replace it with something new, your account will be put in to an restricted state for 30 days.