Famotidine is used to treat and prevent ulcers in the stomach and. Famotidine is used to treat and prevent ulcers in the stomach and intestines.