Sayyiduna Sa’d bin Abi Waqqas (may Allah be pleased with him) narrates that I heard the Messenger of Allah (peace and blessings be upon him) say: “When any one of you expels mucus from his nose in the mosque, he should conceal the filth from his nose so that it does not touch the body or clothes of any believer and cause him harm.”
And the explanation of the evidence that this ruling was given so that this phlegm does not touch the body or clothes of a believer and cause him harm.
Hadith Referenceصحيح ابن خزيمه / جماع أبواب فضائل المساجد وبنائها وتعظيمها / 1311