Rapid weight loss, poor appetite, and nausea are red-flag symptoms which suggest more serious medical conditions and should not be interpreted as merely having any infection including worms or bacteria.
The most important diagnosis to exclude in this case is upper digestive tract cancers. Do consult your doctor to perform diagnostic work-up investigations soonest possible. Some patient may benefit from early endoscopy and tissue biopsy.