Most liquids expand when they are heated and contract when they are cooled.
A thermometer consists of a bulb of liquid connected to a thin capillary tube.
When the liquid is heated, it expands and moves up the capillary column. When the liquid cools, it contracts and moves back down the column.
You can determine the temperature by reading the position of the liquid against a graduated temperature scale.