Bacteria and viruses present in water can be filtered by forcing water through a porous material with pores smaller than the item you wish to filter out. Filtration can act as the gatekeeper to viruses and bacteria if you choose the appropriate type of filtration.
Bacteria are single-celled organisms lacking well-defined nuclear membranes and other specialized functional cell parts which reproduce by cell division or spores. Bacteria may be free-living organisms or parasites. Bacteria (along with fungi) are decomposers that break down the wastes and bodies of dead organisms with sizes ranging approximately from 1 to 10 microns in length and from 0.2 to 1 micron in width. Bacterial cells exist almost everywhere on earth. Of course, some bacteria are helpful to humans, whilst others pose serious health risks. Widely prevalent examples of the latter are E-Coli and Legionella.
Viruses are parasitic infectious microbes, composed almost entirely of protein and nucleic acids. Only reproducing within living cells, viruses are 0.004 to 0.1 microns in size — about 100 times smaller than bacteria. Covid-19 matches these criteria with a size of 0.125 microns or 125 nanometres.
Cysts are capsules or protective sacs produced by many protozoans as preparation for entering a resting or a specialized reproductive stage. Similar to spores, cysts tend to be more resistant to disinfection such as chlorine. Fortunately, protozoan cysts are typically 2 to 50 microns in diameter and can be removed from water by ultrafiltration.