Good afternoon Nishi.228,
Welcome to the Apple Support Communities!
I understand you are having some issues with the "headphones mic" you are using with an iPhone XR. Are you referring to the EarPods with Lightning Connector that was shipped with the iPhone? Are you having any issues with the microphones on the iPhone itself? Have you tried using a different pair of headphones to isolate the issue to the EarPods?
Here is some general information about troubleshooting headphones and testing the microphone on the iPhone. You may need to have an Apple Genius or an Apple Authorized Service Provider take a look at your iPhone and EarPods. Click on the "Service and Support" section of the resource below to find one near you.
Find Locations - Service - Apple Stores and Apple Authorized Service Providers
Use Apple headphones with your iPhone, iPad, and iPod
If your headphones don't work with your iPhone, iPad, or iPod touch
If the microphones on your iPhone, iPad, and iPod touch aren't working
Take care.