Yb3+/Tm3+ co-doped Ba5Gd8Zn4O21 upconversion (UC) phosphors with thermometric and optical heating properties were successfully prepared by a sol-gel process, and crystal structures of all samples were examined by X-ray diffraction (XRD). The phosphors show an intense near-infrared (NIR) and several weak visible emission peaks upon 980 nm excitation. The possible UC mechanisms and processes were proposed based on the power dependence of the upconversion luminescence (UCL) intensities, and the lifetimes of 1G4 → 3H6 blue emissions were also measured to confirm the occurrence of energy transfer (ET). Temperature sensing performances based on the Stark levels (1G4(1), 1G4(2)) of Tm3+ were evaluated by analyzing temperature-dependent UCL spectra in the range 300-510 K. The maximum sensitivity for phosphors with different UCL intensities was discussed in detail and approached approximately 0.0061 K-1 at 300 K. Furthermore, the heating effect produced by laser excitation was also measured, which caused the temperature of sample to rise from 278.8 to 321.8 K upon increasing the pump power from 638 to 1802 mW. The results indicate that Yb3+/Tm3+ co-doped Ba5Gd8Zn4O21 phosphors could be considered as potential candidates for temperature sensors and optical heaters.