I'm 25 stomach feels weird heartburn and burping feel better when I take Pepcid (famotidine) sometime feel weak sweating loss of appetite could it be I'm a cancer or stomach flu?

It could, but.. ...the more likely, in large part, diagnosis is dyspepsia due either to GERD or gastritis--both of which will respond to acid suppression from drugs like Pepcid (famotidine). For your reassurance, simple testing is available through your doctor.