Using US scheduling laws is a horrible comparison on which is 'better.' What about MJ, shrooms, lsd then?
If we're talking about which is healthier, in a controlled context of pure and knowable doses, I'd bet cocaine is worse for you.
The stress it puts on your heart and body are awful. Especially combined with alcohol (which who does a line without drinking) cocaethylene i believe it's called
Opiates cause far more overdoses, but that's mostly because of adulteration and non controlled dosing.
In this ideal world of legal and safe drugs that's my bet.
A safe dose of opiates is way less likely to cause an OD. Long term WDs and dose escalation are dangerous. And mental health issues with long term use are dangerous. But coke is just awful for you, and even worse mental health issues (mania and worse).