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 analyzing correlations between gaseous haloes and galaxy properties.