We present a study of metal-enriched halo gas traced by Mg II and C IV absorption at z < 2 in the MUSE Analysis of Gas around Galaxies survey and the Quasar Sightline and Galaxy Evolution survey. Using these large and complete galaxy surveys in quasar fields, we study the dependence of the metal distribution on galaxy properties and overdensities, out to physical projected separations of 750 kpc. We find that the cool, low-ionization gas is significantly affected by the environment across the full redshift range probed, with =~ 2-3 times more prevalent and stronger Mg II absorption in higher overdensity group environments and in regions with greater overall stellar mass and star formation rates. Complementary to these results, we have further investigated the more highly ionized gas as traced by C IV absorption, and found that it is likely to be more extended than the Mg II gas, with =~ 2 times higher covering fraction at a given distance. We find that the strength and covering fraction of C IV absorption show less significant dependence on galaxy properties and environment than the Mg II absorption, but more massive and star-forming galaxies nevertheless also show =~ 2 times higher incidence of C IV absorption. The incidence of Mg II and C IV absorption within the virial radius shows a tentative increase with redshift, being higher by a factor of =~ 1.5 and =~4, respectively, at z > 1. It is clear from our results that environmental processes have a significant impact on the distribution of metals around galaxies and need to be fully accounted for when analysing correlations between gaseous haloes and galaxy properties.