Two jobs: block and clear
A barrier does two things at once. It blocks entry with a physical seal and chemical defenses, and it clears whatever lands on the surface before it can establish itself. Mucus traps organisms, cilia move the mucus out, urine flow washes the urethra, and tears and saliva dilute and remove microbes. Losing either job opens the door.
Where the failure shows
In cystic fibrosis, thick dehydrated mucus cannot be cleared by cilia, so Pseudomonas aeruginosa and Staphylococcus aureus colonize the airway and cause chronic infection. In primary ciliary dyskinesia, the cilia themselves do not beat, and the same organisms plus Haemophilus influenzae cause recurrent sinusitis, otitis media, and bronchiectasis. A burn destroys the skin barrier over a large area, and the wound becomes a portal for Pseudomonas and other gram-negative bacteria.
Local, not systemic
These defects are localized to the affected surface. A person with immotile cilia has normal antibodies and T cells and can fight a bloodstream infection normally; the problem is that the airway never clears the bacteria in the first place.