Pepcid (famotidine) blocks the production of acid in the stomach. It is used to treat ulcers and other conditions involving excess stomach acid. In addition, Pepcid also treats gastroesophageal reflux disease (GERD), or heartburn, and helps relieve pain caused by stomach ulcers.