Millions of snowbirds visit Mexican border towns every winter to stock up on cheap generic RX meds -- often cheaper than the insurance copay. You don't need to show a script to buy them. You need a passport to get back into the US. Yes you can talk your way back in with other ID but you'll be delayed and hassled. You can be fined if you try it repeatedly. Don't fuck with ICE, don't lecture them about knowing your rights, don't be a dick. Don't be memorable in other words.
You can bring back a 90 day supply of rx meds for your own use through US customs. No controlled substances, but no other restrictions. Don't come and go every effing day like you're hoarding or reselling.
The one I have the most experience with is Algodones, just a few miles from Yuma, AZ. Walk across the border and you'll find a clean, safe, friendly town full of pharmacies, dentists, and optometrists. And great Mexican food. And groceries. Don't bring back fresh produce, anything else except Cuban rum and cigars is fine.
Meds to buy: penicillin and/or Z-packs for infections. Anti-fungals like Diflucan for ladies' yeast infections -- one pill and it's gone in a couple days. The idea of antibiotics expiring and turning toxic is overhyped. Keep them cool and dry and they're okay for years.
Anything you take daily for maintenance, eg heart, digestive, diabetes, migraine, asthma, non-controlled psych meds if you use them, etc. Names of meds might be different, ask for the brand name and they'll get you the generic. Some are different dosage sizes than you get in the US -- be prepared to split pills if you need smaller doses.
Get your shopping done early in the day. Don't wait till the line is several hours long. Pay cash if you can. They all tack on a premium for credit cards. They aren't going to take your insurance. Don't buy bottled water from street vendors while lining up for customs -- they refill used bottles. Algodones tap water is perfectly safe to drink but who the hell knows what's on the bottles themselves.
Lots of nice friendly people will guide you to dentists, eye doctors, etc. They earn a commission on this. Don't worry about it. They'll also be happy to give you directions yo whatever else you're looking for. These guys speak good English. Clerks in the pharmacies speak just enough to grab the meds you want and make the sale. Check med labels before you complete the sale -- rarely they'll get the wrong thing.
Some of the dentists and other med pros live in the US and commute daily to Mexico. Think about the economics of this -- no insurance to deal with (yours or theirs), no back office staff to pay, just a receptionist. That's how a teeth cleaning costs $30, fillings $70, crowns $250. I hear that things like dental implants are a fraction of what they are in the US.
Eyeglasses can be a good deal but only if your prescription is pretty ordinary. High diopters, high index lenses, progressives all end up nearly the same as what you'd pay at Walmart or Costco.
Bargain for souvenirs from sidewalk vendors. Pottery, blankets, leather goods can be good buys. There are a few beggars but it's not terrible like in other places.
Have fun.