Heat transport over super-hydrophobic (SHS) and liquid-infused surfaces (LIS) is studied using direct numerical simulations of a turbulent channel flow. The lower wall of the channel consists of either longitudinal or transversal bars with a secondary fluid locked in the cavities between the surface elements. We consider two viscosity ratios between the fluids mimicking SHS and LIS. The thermal diffusivity is varied to assess its effect on thermal performance. We investigate the dependence of heat transfer on the elements pitch-to-height ratio and on the interface dynamics. The interface deformation (dependent upon the surface tension between the two fluids) is fully coupled to the fluid governing equations with the level-set method. Present simulations are consistent with published results about the drag-reducing potential of SHS and LIS in turbulent flow compared to the smooth wall. In the limiting case of infinite surface tension (the interface remains flat and slippery), heat transfer efficiency (heat transfer to drag ratio) can be enhanced compared to a smooth wall. Although the total heat flux is marginally reduced, SHS and LIS with longitudinal ridges achieve a comparatively larger drag reduction, which increases the efficiency. A model is derived from the energy equation to correlate the heat transfer performance with the thermal slip length ($b_\theta$), analogous to the streamwise slip length ($b$) used in the literature to scale drag reduction. Consistently with the model, results show that heat transfer efficiency is larger than for a smooth wall when the thermal slip length is smaller than the streamwise slip length (longitudinal bars). Vice versa, transversal bars present $b/b_\theta <1$ and a smaller heat transfer efficiency than the smooth wall. In the case of finite surface tension, the dynamics of the interface generates a turbulent flux which improves the thermal performance, but tends to decrease the amount of drag reduction. Liquid-infused surfaces are more robust than SHS to the deformation of the interface thanks to the larger viscosity of the secondary fluid and maintain about the same drag reduction as in the infinite surface tension case. For SHS longitudinal bars, simultaneous increase in heat transfer and reduction in drag are observed, leading to an apparent breakdown of the Reynolds analogy. Also in the case of finite surface tension, heat transfer efficiency scales with the relative magnitude of the thermal and streamwise slip lengths. The results suggest a potential expansion of the control space for engineers. Depending on the application, one can reach an optimal combination of heat transfer and drag by tuning the shape of the substrate and the viscosity and diffusivity ratios.