At one time or another, most of us have had excess stomach acid, leading to that uncomfortable feeling of indigestion and heartburn. When this happens, often after a splurge on junk food, spicy dishes or other indulgences, we want relief, fast.

Relief often comes in the form of an over-the-counter (OTC) antacid, which works by neutralizing acid. Or, we look to drugs known as H2 blockers and proton pump inhibitors (PPIs) that suppress the acid. Thanks to our zealous use of these medicines, the market for these products has grown to billions of dollars a year.

But if you think popping these remedies on an as-needed basis is as harmless as sucking on an after-dinner mint, think again. There are some serious safety risks linked with these drugs.

First and foremost, it’s critical that you talk to your doctor to figure out if you even need the medication, says Jordan J. Karlitz, MD, assistant professor of medicine in the division of gastroenterology at Tulane University and a member of the American College of Gastroenterology. Simple lifestyle changes can be really effective, he says. He tells patients to lose weight if they are heavy, avoid fatty foods and don't eat their ''trigger'' foods. Coffee and chocolate are two common trigger foods. Spicy foods can produce acid, too.

Your doctor can determine how serious your stomach acid problem is, while also discussing the risks and benefits of antacids, acid blockers or suppressors. Together, you can determine which, if any, heartburn treatment makes sense for you.

How stomach acid goes from good to bad

Stomach acid tends to get a bad rap, but certain amounts of it are critical to keeping us healthy. Stomach acid helps protect us from infection-causing ''bugs'' or microorganisms and it also allows the enzyme that digests protein (one of our main fuel sources) to do its job properly.

However, you can run into trouble when your lower esophageal sphincter (a layer of bundled muscles that sit at the base of the esophagus and function as a valve between the esophagus and stomach) relaxes or weakens. When this happens, stomach acid flows back up in to your esophagus. This can lead to heartburn, gastroesophageal reflux (GER) and gastroesophageal reflux disease (GERD). GERD needs to be treated, or serious complications can occur, such as narrowing of your esophagus and even a pre-cancerous condition called Barrett's esophagus.

Weighing your options

Antacids. Mylanta (aluminum/magnesium/simethicone) and Maalox (aluminum/magnesium) are available OTC. Antacids help by neutralizing acid in the stomach. Liquid forms work more quickly, but tablets can be more convenient to use.

Hidden hazard: Antacids can cause diarrhea or constipation. Taking large amount of antacids that include aluminum can make you lose calcium, which is risky for your bone health. 

H2 blockers. Pepcid AC (famotidine); Tagamet (cimetidine); Zantac (ranitidine, others) are another option. Short for histamine 2-receptor blockers, these drugs act on the cells that produce the acid, as well as neutralizing the acid once produced. Some are OTC; stronger doses are by prescription.

Hidden hazard: Depending on the H2 blocker, side effects can include headaches, diarrhea, dizziness or rashes. Side effects, however, are not common. 

PPIs. Nexium (esomeprazole); Prevacid (lansoprazole); and Prilosec (omeprazone). Some are OTC; stronger doses are by prescription. PPIs work by suppressing acid and some research shows they heal the esophagus. 

Hidden hazard: Long-term use of PPIs may cause pneumonia. PPIs make your body less acidic, which allows bacteria to thrive. If these bugs get to your lungs, you can develop pneumonia.

PPIs have also been linked with an infection known as C.diff (Clostridium difficile), a bacterium that can cause life-threatening diarrhea. PPIs can also affect the way you absorb calcium, which is bad news for your bones. B12 levels may be affected by PPIs. B12 is important so you body can make blood cells and maintain a healthy nervous system. 

PPIs in prescription strength may lower your magnesium levels, the Food and Drug Administration warns. Low magnesium can lead to muscle spasms, heart rhythm abnormalities and other problems. 

Despite these risks, Karlitz says, the PPIs tend to work better than the H2 blockers for those who really need them.

Kathleen Doheny is a Los Angeles journalist specializing in health, behavior and fitness topics.