The reason why you shouldn't wash your filter in tap water is because tap water contains chlorine, which kills bacteria.
Inside your filter sponge dwells a type of bacteria that breaks down the ammonia and nitrites in your tank into nitrates, fish pee and poop ammonia and without the bacteria the ammonia levels just rise up without anything to lower them and kill off your fish.
This is one of the main reasons why you should add dechlorinator to your tank, to help remove chlorine and other harmful chemicals present in tap water, so your beneficial bacteria can grow and survive in your filter and why you shouldn't clean out the filter in untreated tap water, most people wash out their filters in water from water changes.
There are many other things that can cause water quality issues like overstocking your tank, letting dead fish or plants rot in your tank or not doing water changes and substrate cleaning sessions often enough, leaving the tank empty with nothing to produce ammonia for the filter bacteria to survive off(as much as it gets rid of ammonia in your tank it also needs a constant siurce to survive, which usually comes in the form of the fish pooping in your tank) etc.
Water changes with dechlorinator are the best way to lower all harmful toxins in your tank(ammonia and nitrates should be 0 in a healthy tank while nitrates under 40), most people do a 30% one once a week with a substrate cleaning session.