Based on: Get a verification code and sign in with two-factor authentication - Apple Support
A code is sent first via data (via the Internet, not as a SMS text message) to your trusted devices (some other Apple computer or Apple mobile device signed in with your account) automatically. If you have a trusted device running iOS 11 and later, OS X High Sierra and later, iPadOS 13 and later, or watchOS 6 and later, the verification code is displayed automatically on your trusted devices.
If you don’t have a trusted device handy, you can choose to have a verification code sent to a trusted phone number as a text message or phone call.
1. Select “Didn’t Get a Code?” or “Can’t get to your devices?” on the verification code screen.
2. Choose to have the code sent to a trusted phone number (select which one—you can have several).
3. You'll get a text message or phone call from Apple with your verification code. This text message might include an additional domain validation line. This line includes the @ symbol, the website name, and your code (for example: @icloud.com #123456 %apple.com).
4. Enter the code on your other device to complete sign in.
It is a good idea to have more than one trusted number and to keep them updated.
If you had set up a recovery contact, read Get a recovery code for a friend or family member as their Apple Account recovery contact - Apple Support
Contact Apple. Refer to this page for Apple Support for different countries ➔
Choose your country or region - Official Apple Support
Select your country (if you do not see your country, also look for "other" in regions; e.g., "Other Africa"), then "Choose a product". Click the "show" item under each category for more selections. If you don't see one that handles your issue then keep experimenting with selections until you reach one that gets you a chat session or a telephone call and get the representative to redirect you.
If after all that you still can’t receive verification codes, you can request account recovery to regain access to your account [ If you forgot your password and can’t sign in to your Apple Account - Apple Support ]. Account recovery might take a few days or longer, depending on the specific account information you can provide to verify your identity.