This paper presents the search for heavy resonances decaying into a pair of [Formula: see text] bosons leading to the [Formula: see text] and [Formula: see text] final states, where [Formula: see text] stands for either an electron or a muon. The search uses proton–proton collision data at a center-of-mass energy of 13 TeV collected with the ATLAS detector from 2015 to 2018 corresponding to an integrated luminosity of 139 [Formula: see text], which is the full data statistics collected during the Run 2 of the Large Hadron Collider (LHC). The mass range for the hypothetical resonances considered spans from 200 GeV to 2000 GeV. In the absence of an observed significant excess, the results are interpreted as upper limits on the production cross-section of a spin-0 or spin-2 resonance. The upper limits for the spin-0 resonance are interpreted to exclusion contours in the context of Type-I and Type-II two-Higgs-doublet models (2HDM), while those for the spin-2 resonance are used to constrain the Randall–Sundrum (RS) model with an extra dimension giving rise to spin-2 graviton excitations.