Doctors prescribe opioids – like hydrocodone, oxycodone, and morphine – to treat moderate to severe pain. Opioids are often prescribed following a surgery or injury or for certain health conditions.