Dear Mary Shaw,
Chronic phlegm with occasional blood spotting occult/dark has a cause in the lower respiratory tract
should have been done well before.
But, do not worry much, infections if any detected can be well treated by powerful antibiotics.
Your GIT issue is separate and might have occurred due to excessive ingestion of the phlegm over months as you said.
Keep the following in mind:
1. Don't overdo in coughing out the phlegm, let it come out on its own.
2. Keep note of changes in colour, consistency etc as you did.
3. Do some good warm water gargling with OTC Iodine
mouth gargle diluted in water 3-4 times daily.
4. Try to cover your mouth with some scarf/cloth.
5. Avoid oily/spicy foods.