Temperature is what is used to measure thermal energy
The more thermal energy a substance has, the more warmer it will be. So when the temperature is high, there is a lot of thermal energy
Thermal energy is just energy. It refers to the energy of the molecules. Temperature is just a measurement