If you have another trusted phone number or another trusted device, you can use that. See the "What if I can't access a trusted device or didn't receive a verification code?" section of Two-factor authentication for Apple ID - Apple Support
If not, see the following from that same support page:
If I can't sign in, how do I regain access to my account?
If you can’t sign in, access a trusted device, reset your password, or receive verification codes, you can request account recovery to regain access to your account. Account recovery is an automatic process designed to get you back in to your account as quickly as possible while denying access to anyone who might be pretending to be you. It might take a few days—or longer—depending on what specific account information you can provide to verify your identity.
If you generated a recovery key, you can use your recovery key to regain access to your account instead. Learn more about using a recovery key.
and
Can Apple Support help me regain access to my account?
Apple Support can answer your questions about the account recovery process, but can't verify your identity or expedite the process in any way.
Also note, that after you regain access I would recommend setting up at least one additional trusted phone number. The trusted phone numbers can be Android phones, landlines, friends' or relatives' phones. The instructions are in the same support page as above.