This issue comes up when an individual is eligible for Medicare, but also has other coverage. It's known as "coordination of benefits." The answer is, it depends on the type of coverage you have.
For example, if you have Medicare and Medicaid, then Medicare always pays first. Medicaid would only pay the amount remaining after Medicare pays for it's share.
If you are 65 or older and covered by a group health plan because you or your spouse is working, then it depends on how many employees your employer has. If there are 20 or more employees, then the group health plan pays first, and Medicare pays any amount remaining. If there are less than 20 employees, then Medicare pays first and the group health plan pays the remaining amount.
Other situations, such as coordination of worker's comp, Veteran's benefits and TRICARE are addressed in Medicare's Guide to Who Pays First: https://www.medicare.gov/Pubs/pdf/02179.pdf