As cosmic microwave background (CMB) photons traverse the Universe, anisotropies can be induced via Thomson scattering (proportional to the integrated electron density; optical depth) and inverse Compton scattering (proportional to the integrated electron pressure; thermal Sunyaev-Zel'dovich effect). Measurements of anisotropy in optical depth τ and Compton y parameter are imprinted by the galaxies and galaxy clusters and are thus sensitive to the thermodynamic properties of circumgalactic medium and intergalactic medium. We use an analytic halo model to predict the power spectrum of the optical depth (τ τ ), the cross-correlation between the optical depth and the Compton y parameter (τ y), as well as the cross-correlation between the optical depth and galaxy clustering (τ g), and compare this model to cosmological simulations. We constrain the optical depths of halos at z 3 using a technique originally devised to constrain patchy reionization at a much higher redshift range. The forecasted signal-to-noise ratio is 2.6, 8.5, and 13, respectively, for a CMB-S4-like experiment and a VRO-like optical survey. We show that a joint analysis of these probes can constrain the amplitude of the density profiles of halos to 6.5% and the pressure profile to 13%, marginalizing over the outer slope of the pressure profile. These constraints translate to astrophysical parameters related to the physics of galaxy evolution, such as the gas mass fraction, f g , which can be constrained to 5.3% uncertainty at z ∼ 0, assuming an underlying model for the shape of the density profile. The cross-correlations presented here are complementary to other CMB and galaxy cross-correlations since they do not require spectroscopic galaxy redshifts and are another example of how such correlations are a powerful probe of the astrophysics of galaxy evolution.