How does the acidity of soft drinks not affect certain drugs, such as opiates? What about drugs and stomach acid? Here's a very random introduction. I heard the term, "dirty Sprite" (it's some rap album/slang term) on a YouTube advertisement. I Googled "dirty Sprite", and it's apparently a recreational drug: codeine syrup in Sprite lemon-lime soda. People allegedly get high off of it, meaning the opiates in codeine is metabolized properly. My question is, how does harsh acidity of the Sprite (pH of 3.4-3.8 if you trust Google) not interfere with the codeine structure and mitigate its metabolism?

Then, this turned into a meta philosophical question: how does the acidity of the stomach, which is more acidic than Sprite, not interfere with not only codeine, but other substances?
Many drugs are not very soluble in water what is a common property for a lot of organic substances, including Codeine. Therefor it is very common to turn them into their hydrochlorid which is simply $\text{Drug}\ce{.HCl}$. [4] E.g., Crystal Meth got it's name from the crystals that the hydrochloride forms.

$\hskip1.7in$
Source: Wikimedia Commons

Other examples are, e.g., Cocaine, Cetirizine, hydroxyzine, and many more.

As your substance is either the hydrochloride or would turn into the hydrochloride in stomach there should not be any destructive influence on the structure of the drug. In fact it even promotes the absorption.

On the other hand, the better solubility of the corresponding hydrochloride is a relatively big problem for those drugs that should not get absorbed in the stomach. They need to be coated to "survive" the stomach acidity to reach the intestine where they should get absorbed.