What is this "bad bacteria"???
I think what you mean is the parasites in the fish.
When you introduce new fish, it usually has some parasites from the wild. Most parasites spread by releasing "babies" into the water column to infect other fishes. If you have healthy fishes, they can defend themselves. If they are weak, they will be infected. These parasites will die out if they don't have a host within a period of time.
As these parasite spreads through the water column ... no fish in sand, so they don't really populate the sand or filter ... the UV filter will kill them. Even if they are in the sand or filter, they will die naturally without a fish host.
Hope this helps.