All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
There is no harm in verbally mentioning Allah while one has some impurity in their garment or body. It is not a condition when verbally mentioning Allah, that the person mentioning Allah should be pure from any impurity in his body or clothes, whether by saying the Basmalah [i.e. Bismi Allah (in the Name of Allah)] or exalting the mention of the Prophet or any other Athkaar (mention of Allah).
It is also not a condition to be pure from minor or major ritual impurity except when one recites the Quran, as a person is not allowed to recite the Quran when he is in a state of major ritual impurity (sexual defilement).
However, there is no doubt that taking the initiative to purify the clothes is more appropriate.
Allah knows best.