Will it be confusing if I hear someone say “an injection of a drug”, since the word drug has the meaning of either a medicine or an illegal narcotic substance?
Here is the thing. “Injection of a drug” is not a very suitable “bed side” phrase (see “bed side manners”) for medical practitioner such as doctor or nurse to use.
It focuses on the crude act of penetrating the skin with a needle, which requires us to distance ourselves from the subject who is receiving the procedure. Therefore, this usage could appear in a technical context, like a medical or scientific paper, or about injection of narcotics (“safe injection site”).
A softer word used around patients would be “administration of a drug” or something. I can’t imagine a nurse coming around and saying, “we’re going to inject you with the drug now”. Yikes!
So your intuition is right that there is something about “inject the drug”, but the distinction doesn’t revolve around legal versus illegal, but rather about whether we have empathy for the recipient of the procedure, including the concern about the recipient’s emotional response to our choice of words in regard to the procedure.
When a speaker uses “inject” for narcotic users, it’s because he or she is comfortable discussing the issue without sugar-coating the language, or else doesn’t feel empathy toward the recipients of a procedure when it is self-inflicted.
Note that the execution method “lethal injection” is, of course, legal, too.