Hacking up phlegm is not pleasant. Also not pleasant: spelling phlegm incorrectly as phlem.
Coughing picture from Shutterstock
No, it isn't logical to include a G in phlegm, but that has been the spelling for several hundred years, and it's just another English-language exception we have to live with. Like last week's lingustic offender harbour, the spelling shift was put in to reflect the term's origins in ancient Greek, a distinction which isn't very helpful to us now.
Nor are there many acceptable synonyms. If you're feeling technical, neither mucus nor snot is the same thing as phlegm (the former is the regular lining found in various respiratory systems, not the reaction to a disease, and the latter only comes from the nose). If you need to write "phlegm", you need the G. Accuracy matters.
Lifehacker's Mind Your Language column offers bossy advice on improving your writing.