As others have said, an epidural is not a drug, but a technique.
In past eras, opiates were commonly used through labor. And babies were often born 'depressed' -- having trouble breathing well and sleepy. Moms were also very sleepy, and less able to interact with their newborns. (Baby did not get high, and did not become addicted -- but was sleepy.)
Once epidurals were developed, they became the norm for women who need pain relief in labor -- they are safer AND more effective. A win-win situation.
Opiates are still sometimes used during labor. Sometimes if early labor is prolonged and mom is getting tired, a drug like morphine might be given to give the laboring woman a break and 'take the edge off' the pain, without leaving mom paralyzed from an epidural for many hours. When given early in labor, it's usually worn off before baby is born and does not affect baby's ability to breathe. (Or mom's ability to hold her baby and breastfeed.)