Try getting a verification code on another device or use account recovery.
Based on: https://support.apple.com/102606
A code is sent automatically first to your trusted devices (some other Apple computer or Apple mobile device signed in with your account). If you have a trusted device running iOS11 (or iPadOS) and later, macOS 10.13 (High Sierra) and later, or watchOS 4 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 your 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 a telephone number for where to receive a code.
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.
If you had set up a recovery contact, read https://support.apple.com/HT212515
If you find you can’t sign in, reset your password, or receive verification codes, you can request account recovery (get Apple’s own instructions in this article: https://support.apple.com/118574 ) to regain access to your account. Account recovery might take a few days or longer, depending on the specific account information you can provide to verify your identity. One tip to using account recovery is to look for options in small blue letters beneath the normal log-in items if you cannot complete the requested information.
Here are links to posts by Community contributors which provide additional detail about the account recovery process and what to do if you do not receive a text or call: https://discussions.apple.com/thread/255401538?answerId=260044580022 and https://discussions.apple.com/thread/255909322?answerId=261058302022 and https://discussions.apple.com/thread/256188713?answerId=261688110022. This thread outlines the multi-step process and final recovery —> https://discussions.apple.com/thread/255733423 , and this one about things you should and should not do while waiting —> https://discussions.apple.com/thread/256148234?answerId=261595361022 This is a very long user contributed document about account recovery —> https://discussions.apple.com/docs/DOC-250009681