Is this about sharing passwords in a Family group?
Share passwords and passkeys with people you trust on iPhone - Apple Support
In case this is about resetting the Apple Account password, there are different ways to receive the verification code, to proceed with the Apple Account password reset.
On the trusted device, by getting a phone call or text message from Apple, or the Account Recovery process:
...

...
If you don’t have a trusted device handy, you can have a verification code sent to your trusted phone number as a text message or phone call.
- Select “Didn’t Get a Code?” or “Can’t get to your devices?” on the verification code screen.
- Choose to have the code sent to your trusted phone number.
- You’ll get a text message or phone call from Apple with your verification code. If you use the Unknown Senders filtering in the Messages app, check there for your verification code.

4 . Enter the code on your other device to complete sign in.
...
If you temporarily don’t have access to your trusted devices or trusted phone number, the fastest way to get access to your account is to wait until you have access in the next few days. Then sign in with two-factor authentication. After you do that, you can also add additional trusted phone numbers to your account for the future.
If you permanently don’t have access to either your trusted devices or your trusted phone number, you can still attempt to recover access to your account.
- Try to sign in to your Apple Account.
- Select “Didn’t Get a Code?” or “Can’t get to your devices?” on the verification code screen.
- Choose “Can’t use [phone number]”.
- If you don’t have access to any trusted phone number on file with your Apple Account, you can initiate the process to recover access to your account. Follow the onscreen steps.
Account recovery might take a few days or longer, depending on the specific account information you can provide to verify your identity. Contacting Apple can’t help speed up the process.
...
copied from: Get a verification code and sign in with two-factor authentication - Apple Support