Opioid antagonists work by competing with opioids for the same receptor sites in the brain. By occupying these receptors, they prevent opioids from exerting their effects, such as euphoria and respiratory depression. This mechanism is particularly important in cases of opioid overdose, where rapid administration of an antagonist like naloxone can restore normal breathing and consciousness.