Methadone is a prescription medication primarily used in the treatment of opioid use disorder and, in certain medical circumstances, for managing severe chronic pain. It belongs to a class of medicines known as opioid agonists and works by acting on specific receptors in the brain to reduce opioid cravings, withdrawal symptoms, and pain.