Your trusted number should never be the same as your only Apple device., it defeats the purpose of having a trusted phone number. Trusted phone numbers should be a secondary way to get the code when your iPhone is not available or accessible.
If you cannot access your iPhone to get the code normally and your trusted phone number is also the one on your broken iPhone then there's no direct way to get the code.
If your XR uses a physical SIM card, you may be able to move the SIM card to a different device that can get calls or SMS messages and then send a code to the trusted number instead as an SMS or voice call that you can then then get on the other device.
click here ➜ About trusted phone numbers and trusted devices for Apple Account - Apple Support
Otherwise, you'll need other go through the account recovery process.
click here ➜ How to use account recovery when you can’t reset your Apple Account password - Apple Support