Thanks for asking.
Based on your query, my opinion is as follows.
1. Red stuff could be blood, while black stuff could be acid dissolved hemoglobin
. If it is secondary to vomiting.
2. Due to gastritis
or gastroesophageal reflux disease
, internal bleeding
could be leading to present cause.
3. Get an upper GI endoscopy for evaluation of any bleeding points. If not CT angiogram will be helpful to look for any active bleeding. IBS usually causes diarrhea. No upper GI symptoms usually.
4. If its spitting, look into pollution surrounding you like asbestos or smoking. This could be secondary to bleeding inside respiratory tract
. Get a chest X-ray and CT of lung for evaluation of any tumors.
Hope it helps.
Any further queries, happy to help again.