a substance is matter that contains only one type of atom or molecule.
Ice, water and steam are the three states of the same substance because they consist of same constituent elements (i.e., hydrogen and oxygen), same molecules and same chemical properties. Only the arrangement of the molecules differ in these three states. In ice, the molecules are densely packed, while in water, the molecules are somewhat loosely packed. In steam, the molecules are far off from each other.
Freezing of water changes it's state from liquid to solid, i.e, ice. Melting of ice changes it's state of matter from solid to liquid, i.e, water. And when we
boil this water, it's state of matter changes from liquid to gas, i.e, steam. And when we condense this steam, it forms water.
Therefore,we conclude that, ice - water - steam are the three different states of a substance and not different substances.All these change of states are due to different temperatures applied.