opioid
The body has its own painkilling system, with natural 'keys' (endorphins) that fit pain-dampening locks on nerve cells. An opioid is a man-made or plant-derived key that fits the same locks, turning down the volume of pain signals before they reach awareness. That is why opioids are among the strongest painkillers known.
The locks are opioid receptors, G-protein-coupled receptors of three main types: mu, delta, and kappa. Most clinically important opioids are agonists at the mu receptor, which mediates the strongest pain relief but also the euphoria and the dangerous slowing of breathing.
Chemically the prototype is morphine, with its rigid polycyclic morphinan scaffold and a critical basic nitrogen that, when protonated, forms an ionic interaction with the receptor. Simpler molecules such as fentanyl share the essential elements (an aromatic ring and a basic amine at the right distance) while abandoning the rest of morphine's skeleton, showing how a pharmacophore can be captured in very different chemistry.
An honest caveat: opioids cause tolerance, physical dependence, and risk of fatal respiratory depression, and have driven a public-health crisis of addiction and overdose, so their use demands great caution.
Fentanyl keeps morphine's essential pharmacophore points (an aromatic ring and a basic nitrogen) but on a totally different, more lipophilic scaffold, making it far more potent and faster-acting.
Same pharmacophore, different scaffold — a textbook case of scaffold hopping.
Naloxone, an opioid antagonist, occupies the same mu receptor without activating it and can rapidly reverse an overdose by displacing the agonist.