NSAIDs, such as ibuprofen and aspirin, work by inhibiting cyclooxygenase (COX) enzymes, reducing prostaglandin production, and thus decreasing inflammation and pain. Acetaminophen primarily acts on the central nervous system, modulating the pain threshold. Opioids, such as morphine and oxycodone, bind to opioid receptors in the brain, altering the perception of pain.