Atoms and molecules are arranged in different ways in solids, liquids and gases.Solids have a fixed volume and shape. Atoms and molecules are held in position by the forces - bonds - between them, vibrating about a position fixed in the solid. The amount of vibration increases with temperature.
If the solid is heated to a high enough temperature, the bonds start to break, and atoms become free to move. When all the bods are broken the solid becomes a liquid. Liquids are also said to have a fixed volume - actually anything will compress if you apply great enough forces, but liquids are nearly in compressible. Liquids do not have a fixed shape or volume and make take the shape of any container. There are short range forces between atoms and molecules which keeps them close together. These bonds are repeatedly reformed and re broken, but are always present.
If the liquid is heated to a high enough temperature, the atoms and molecules move further apart and the short range forces disappear. Gases expand to fill any container. Gases exert a pressure on the walls of any container.
In reverse, cooling a gas produces a liquid, and cooling a liquid produces a solid.