What is required for advanced lungs to filter dangerous chemicals (so to speak, to carry out the detoxification process) and then use oxygen? (It is advisable to take into account the above record, since the concept of using a second pair of lungs already exists; you need a different solution).
The main question: what needs to be changed (added) in the lungs of a person so that he is not poisoned by toxic air. For example, mine air may contain gases such as nitrogen, methane, carbon monoxide (carbon monoxide is very toxic, easily combines with hemoglobin in the blood, preventing oxygen from entering the bloodstream and causing oxygen starvation of the body.), sulfur dioxide, hydrogen sulfide, nitrogen oxides, methane, hydrogen, heavy hydrocarbons, radon, ammonia and other harmful gases, as well as water vapor and dust. This link shows the poisonous gases that need to be dealt with: https://vk.com/wall544212004_7.
(In my opinion, it would be possible to modify the lungs so that between the blood vessels and the alveoli there was some kind of structure that filters the air from chemically hazardous substances.)
To reiterate: What needs to be changed in the lungs (or somewhere else) of a person so that he can breathe poisonous air?
Filled with sulphurous gases (Oxide sulfur (IV)), for example, in principle, the better this person will carry the gases poisonous to us in the atmosphere, the better.