NO. It is not illegal to drive while using prescription medication. However, to avoid DWI charges, you should do so safely and meet the following essential conditions:
You should have a legal prescription for the medication
You should not meet the legal definition for intoxication while driving.
According to the Texas Penal Code (TPC), intoxication is a lack of physical or mental ability to safely operate a motor vehicle due to distractions caused by alcohol, illegal drugs, controlled substances, and other substances such as over-the-counter medications. Should the law enforcement officers have reason to believe that you cannot safely operate your car owing to the prescription medication you took, you may face drug DWI charges.