Praise be to Allaah.
Dirty things are of two types: Things that are considered dirty or unclean according to sharee’ah because of najaasah (impurity), such as human urine or faeces, and things that are considered dirty by people, but they are not naajis according to sharee’ah, such as mucus and spittle. It is not permissible to carry the former or have them on one’s person whilst praying or to put them in the mosque; it does not matter if one carries the latter in one's pocket whilst praying. And Allaah knows best.
Sheikh Muhammed Salih Al-Munajjid