See the information in Two-factor authentication for Apple ID - Apple Support including the following excerpt:
Manage your trusted phone numbers
To use two-factor authentication, you need at least one trusted phone number on file where you can receive verification codes. Consider verifying an additional trusted phone number other than your own phone number. If your iPhone is your only trusted device and it is missing or damaged, you will be unable to receive verification codes required to access your account.
Update your trusted phone number on your Apple ID account page
- Go to appleid.apple.com.
- Sign in with your Apple ID.
- Go to the Security section and click Edit.
If you want to add a phone number, click Add a Trusted Phone Number and enter the phone number. Choose to verify the number with a text message or automated phone call, and click Continue. To remove a trusted phone number, click next to the phone number you want to remove.
and
If you're signing in and don’t have a trusted device handy that can display verification codes, you can have a code sent to your trusted phone number via text message or an automated phone call instead. Click Didn't Get a Code on the sign in screen and choose to send a code to your trusted phone number. You can also get a code directly from Settings on a trusted device. Learn how to get a verification code.
I have used two-factor since it was first released and I have two trusted phone numbers, but I have never had to use either of them. If you have your phone or other trusted device with you, they shouldn't ever be needed. But if one is needed, you can select which one to use at the time that you request a code to be sent.