An addiction specialist explains when it makes sense to take one of these powerful drugs—and for how long.

It might not seem like a big deal to take a pain med prescribed by your doctor. But if the drug falls into the opioid category, you may want to have a deeper conversation with your physician.

Opioid medications—such as codeine, oxycodone, and fentanyl—work by attaching to opioid receptors in the body and brain to lower the perception of pain. They can be very effective, but also highly addictive.

The longer you take an opioid, the more you may need to get the same pain-killing effect, says Antoine Douaihy, MD, a professor of psychiatry and medicine at the University of Pittsburgh School of Medicine. "They aren't an appropriate long-term pain management option," he told Health in a prior interview.

But in recent years, there's been a "dramatic increase in the acceptance" of opioids to treat conditions like osteoarthritis and back pain, according to the United States Centers for Disease Control and Prevention. The number of scripts written for opioids has nearly quadrupled since 1999. And in the same period, the number of deaths from prescription opioid meds has grown fourfold.

Today we are in the middle of an opioid overdose epidemic. “Unfortunately, health care practitioners have contributed to this public health crisis over the past two decades,” Dr. Douaihy said. “We underestimated the addictive potential of opioid painkillers [at first] and they’ve been overprescribed.”

So when does it actually make sense to take an opioid?

Only when you really need it, says addiction specialist Indra Cidambi, MD, medical director of the Center for Network Therapy in Middlesex, New Jersey—if you just had major surgery, for example, or you're in crippling agony after an accident.

And in general, you should limit your use of an opioid as much as possible: “Most of the time, for acute injuries, you don’t need it for more than a few days,” Dr. Cidambi told Health. If your doctor suggests you take an opioid for longer than a week, ask if there other options.

To get our best wellness advice delivered to your inbox, sign up for the Healthy Living newsletter

The CDC also recommends talking to your doc about nonopioid alternatives, such as physical therapy and interventional therapies (injections). Other matters to discuss: Any problems you've had with drug or alcohol abuse, and the risks involved in taking these powerful drugs.

As many as one in four people who are prescribed opioids long-term (for non-cancer pain) by a primary care physician will struggle with addiction, according to the CDC. But the risks go beyond addiction and overdose. They may include vomiting, dizziness, depression, itching, even increased sensitivity to pain.

Finally, if you do decide to take an opioid, be sure to follow up regularly with your doctor, the CDC urges.