I heard some brothers a while back say something like “the school doesn’t give us proper AC cause they know we’re sand monkeys” and they all started laughing. Soon after one of them led the prayer and I prayed behind him. Is my salah valid or no because they made that kufr joke?

Ustadh AbdulAziz al-Haqqan
You suffer from heavy waswas, and that is what you should be tackling and paying attention to. One of the most effective ways of dealing with that is ignoring these thoughts and knowing that this is not even disbelief in the first place; it is just these compulsive thoughts. May Allah (subhanahu wa ta'ala) protect us and you.