ABSTRACT Ultraviolet (UV) transmission spectroscopy probes atmospheric escape, which has a significant impact on planetary atmospheric evolution. If unaccounted for, interstellar medium absorption (ISM) at the position of specific UV lines might bias transit depth measurements, and thus potentially affect the (non-)detection of features in transmission spectra. Ultimately, this is connected to the so called ‘resolution-linked bias’ effect. We present a parametric study quantifying the impact of unresolved or unconsidered ISM absorption in transit depth measurements at the position of the Mg ii h&k resonance lines (i.e. 2802.705 Å and 2795.528 Å, respectively) in the near-ultraviolet spectral range. We consider main-sequence stars of different spectral types and vary the shape and amount of chromospheric emission, ISM absorption, and planetary absorption, as well as their relative velocities. We also evaluate the role played by integration bin and spectral resolution. We present an open-source tool enabling one to quantify the impact of unresolved or unconsidered Mg ii ISM absorption in transit depth measurements. We further apply this tool to a few already or soon to be observed systems. On average, we find that ignoring ISM absorption leads to biases in the Mg ii transit depth measurements comparable to the uncertainties obtained from the observations published to date. However, considering the bias induced by ISM absorption might become necessary when analysing observations obtained with the next generation space telescopes with UV coverage (e.g. LUVOIR, HABEX), which will provide transmission spectra with significantly smaller uncertainties compared to what obtained with current facilities (e.g. HST).