A gas, a liquid, and a solid are simply different forms of the same thing. And that form is determined by how hot that substance is and how much pressure is applied to it.
Heat can turn a solid into a liquid by giving its molecules more energy and motion, and then turn the liquid into a gas, in which the molecules are so energized that they move about wildly.
When we say that oxygen is a gas, or that iron is a solid, we don’t mean that they are always in those forms everywhere in the universe. What we mean is that, at temperatures common on earth, oxygen is found as a gas and iron is found as a solid.
It would have to get pretty cold to turn oxygen into a liquid, about 300 degrees below zero, while oxygen would become a solid only at 360 degrees below zero! And it would have to get pretty hot for iron to become a liquid, about 2,786 degrees, and at 4,955 degrees, it would become a gas!