Actually the two are nothing alike, the opioid epidemic came most from the advent of newer pain killers before anyone knew how addictive they could be, most in the epidemic started out with legit prescriptions for legit injuries, doctors were giving them out like candy, a lot of speed in the 50's and early 60's.
Crack started out at a cheap alternative street drug and still is to this day. Crack was and is surrounded with crime and violence, and by crime I do not mean the crime related to buying and using the drug. Most of the opioid users are about self-destruction and impact on their families and friends.
We have sunk billions and billions into addressing illegal drugs and have lost billions more in the crimes related to it.
The approach to dealing with it has nothing to do with black people, white people caught using, buying, selling crack are subject to the exact same punishment as black people, there is no way to become legally addicted to crack, there is no legal way in any form to get crack from a doctor and never has been. This is not true for opioids, they are prescribed by doctors and that is how most got hooked on it, like speed this really caught the medical profession off guard, much like speed did decades ago.