  A search for resonances in the dielectron and dimuon mass spectra from 250
GeV to 6 TeV is presented. The data were recorded during Run 2 of the LHC by
the ATLAS experiment using proton-proton ($pp$) collisions with a
center-of-mass energy of $\sqrt{s} = 13$ TeV. The integrated luminosity of the
data corresponds to 139 fb$^{-1}$. The background models are a functional form
fit to the data, and generic signal shapes are used to represent various models
with different resonant widths and masses. No significant deviation from the
expected background is observed and 95\% confidence level upper limits are set
on the fiducial cross-section times branching ratio for models of various
widths. For benchmark models, limits are converted to lower limits on the
resonance mass and reach 4.5 TeV for the E$_6$ motivated $Z'_\psi$ boson.
