The answer would be: physically trapping of pathogens
Mucus has a high viscosity that could physically trap the pathogens so it could not attack the body cells. In respiratory it could also sweep all the debris because the respiratory epithelial cell has cilia that constantly moves.
It won't help in oxygen absorption, it could disrupting the oxygen absorption instead as it could physically block the air.