Using the results of the IllustrisTNG simulation we estimate the dispersion measure which may be attributed to halos of so called host galaxies of fast radio bursts sources (FRBs). Our results show that in contradiction to assumptions used to show the applicability of FRBs to cosmological tests, both the dispersion measure and its standard deviation calculated for host galaxies with given stellar mass in general increase with the redshift. The effect is not strong and cosmological tests using FRBs will be possible, but to preserve the level of statistical uncertainty the number of FRBs with known redshift in a sample should be increased by 15%--35% depending on circumstances. We show various statistical characteristics of ionized gas surrounding galaxies, the resulting dispersion measure and their dependence on the host galaxy stellar mass, redshift, and the projected distance of a FRB source from its host center. Cosmology: theory -- Galaxies: halos -- large-scale structure of Universe