Pepcid is used to treat ulcers of the stomach and intestines and to prevent intestinal ulcers from coming back after they have healed. This medication is also used to treat certain stomach and throat (esophagus) problems (such as erosive esophagitis, gastroesophageal reflux disease-GERD, Zollinger-Ellison syndrome). It works by decreasing the amount of acid your stomach makes. It relieves symptoms such as a cough that doesn’t go away, stomach pain, heartburn, and difficulty swallowing.