Sterile neutrinos can affect the evolution of the universe, and thus using the cosmological observations can search for sterile neutrinos. In this work, we use the cosmic microwave background (CMB) anisotropy data from the Planck 2018 release, combined with the latest baryon acoustic oscillation (BAO), type Ia supernova (SN), and Hubble constant (H0) data, to constrain the cosmological models with considering sterile neutrinos. In order to test the influences of the properties of dark energy on the constraint results of searching for sterile neutrinos, in addition to the Λ cold dark matter (ΛCDM) model, we also consider the wCDM model and the holographic dark energy (HDE) model. We find that sterile neutrinos cannot be detected when the H0 local measurement is not included in the data combination. When the H0 measurement is included in the joint constraints, it is found that ∆N eff > 0 is detected at about 2.7σ level for the ΛCDM model and at about 1-1.7σ level for the wCDM model. However, m eff ν,sterile still cannot be well constrained and only upper limits can be given. In addition, we find that the HDE model is definitely ruled out by the current data. We also discuss the issue of the Hubble tension, and we conclude that involving sterile neutrinos in the cosmological models cannot truly resolve the Hubble tension.