They may either release heat or gain heat. With a temperature increase, the kinetic energy increases and the state of matter will increase (example, ice to water aka solid to liquid)
If the temperature decreases, then the kinetic energy decreases and the state of matter will decrease (example, water vapor to water aka gas to liquid)
Have a nice day!
I hope this is what you are looking for, but if not - comment! I will edit and update my answer accordingly. (ノ^∇^)