Yellow mucus is seen in case of a bacterial infection, lower respiratory tract infection, sinusitis, cold, or flu. Know that it is the accumulation of inflammatory cells that produce a thick, yellow mucus. Besides, the ejection of phlegm becomes very painful and uncomfortable, especially when it thickens.