A search for high-mass dielectron and dimuon resonances in the mass range of 250 GeV to 6 TeV is presented. The data were recorded by the ATLAS experiment in proton–proton collisions at a centre-of-mass energy of s=13 TeV during Run 2 of the Large Hadron Collider and correspond to an integrated luminosity of 139 fb−1. A functional form is fitted to the dilepton invariant-mass distribution to model the contribution from background processes, and a generic signal shape is used to determine the significance of observed deviations from this background estimate. No significant deviation is observed and upper limits are placed at the 95% confidence level on the fiducial cross-section times branching ratio for various resonance width hypotheses. T...