I've been waking up with a pain in the upper cavity of my mouth and lots of yellow phlegm, but I feel fine. What medicine should I be taking?

Pain & phlegm. See your pcp for evaluation of what is causing your pain & phlegm. Might be sinus infection or dental abscess, or uri. Doc's exam will determine the appropriate medicine for the condition.