How does the acidity of soft drinks not affect certain drugs, such as opiates? What about drugs and stomach acid?
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.