system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Does it make a difference when you cough up phlegm whether you swallow it or spit it out?
gpt
Not really. Phlegm is mucus and crud from your breathing parts. By coughing up the phlegm you are "taking out the trash" in your lungs. If you swallow it, the stomach acid will kill everything that was in the phlegm that your body wanted to get rid of. 

I think, for most people, it's a matter of the consistency of the phlegm that makes it difficult/nasty to swallow.