One way to prevent them is switch to an “all natural” deodorant. Many deodorants, especially aerosols, have trace amounts of various metals in them, usually iron. That’s what causing the yellow stains: sweat+fine metals.
For white shirts that are already stained, after you wash them, while they are still wet, spray the affected area with hydrogen peroxide. Then let them hang dry in a very sunny area. When the shirt dries, the stains will be lighter/gone. You can repeat this on dry shirts as well, for tougher stains.