A search for heavy right-handed Majorana or Dirac neutrinos N-R and heavy right-handed gauge bosons W-R is performed in events with energetic electrons or muons, with the same or opposite electric charge, and energetic jets. The search is carried out separately for topologies of clearly separated final-state products (resolved channel) and topologies with boosted final states with hadronic and/or leptonic products partially overlapping and reconstructed as a large-radius jet (boosted channel). The events are selected from pp collision data at the LHC with an integrated luminosity of 139 fb(-1) collected by the ATLAS detector at root s = 13 TeV. No significant deviations from the Standard Model predictions are observed. The results are interpreted within the theoretical framework of a left-right symmetric model, and lower limits are set on masses in the heavy right-handed W-R boson and N-R plane. The excluded region extends to about m(W-R) = 6.4 TeV for both Majorana and Dirac N-R neutrinos at m(N-R) 1 TeV. N-R with masses of less than 3.5 (3.6) TeV are excluded in the electron (muon) channel at m(W-R) = 4.8 TeV for the Majorana neutrinos, and limits of m(N-R) up to 3.6 TeV for m(W-R) = 5.2 (5.0) TeV in the electron (muon) channel are set for the Dirac neutrinos. These constitute the most stringent exclusion limits to date for the model considered., ANPCyT, Argentina; YerPhI, Armenia; ARC, Australia; BMWFW, Austria; FWF, Austria; ANAS, Azerbaijan; CNPq, Brazil; FAPESP, Brazil; NSERC, Canada; NRC, Canada; CFI, Canada; CERN; ANID, Chile; CAS, China; MOST, China; NSFC, China; Minciencias, Colombia; MEYS CR, Czech Republic; DNRF, Denmark; DNSRC, Denmark; IN2P3-CNRS, France; CEA-DRF/IRFU, France; SRNSFG, Georgia; BMBF, Germany; HGF, Germany; MPG, Germany; GSRI, Greece; RGC, China; MEiN, Poland; FCT, Portugal; MNE/IFA, Romania; MESTD, Serbia; MSSR, Slovakia; ARRS, Slovenia; MIZS, Slovenia; DSI/NRF, South Africa; MICINN, Spain; SRC, Sweden; Wallenberg Foundation, Sweden; SERI, Switzerland; SNSF, Switzerland; Canton of Bern, Switzerland; Canton of Geneva, Switzerland; MOST, Taiwan; TENMAK, Turkiye; STFC, United Kingdom; DOE, United States of America; NSF, United States of America; BCKDF, Canada; CANARIE, Canada; Compute Canada, Canada; CRC, Canada; PRIMUS, Czech Republic [21/SCI/01]; UNCE, Czech Republic [SCI/013]; COST, European Union; ERC, European Union; ERDF, European Union; Horizon 2020, European Union; Marie Sklodowska-Curie Actions, European Union; Investissements d'Avenir Labex, France; Investissements d'Avenir Idex, France; ANR, France; DFGandAvHFoundation, Germany; Herakleitos programme - EU-ESF; Thales programme - EU-ESF; Aristeia programme - EU-ESF; Greek NSRF, Greece; BSF-NSF, Israel; MINERVA, Israel; Norwegian Financial Mechanism 2014-2021, Norway; NCN, Poland; NAWA, Poland; La Caixa Banking Foundation, Spain; CERCA Programme Generalitat de Catalunya, Spain; PROMETEO Programme Generalitat Valenciana, Spain; GenT Programme Generalitat Valenciana, Spain; Goran Gustafssons Stiftelse, Sweden; Royal Society, United Kingdom; Leverhulme Trust, United Kingdom, We thank CERN for the very successful operation of the LHC, as well as the support staff from our institutions without whom ATLAS could not be operated efficiently. We acknowledge the support of ANPCyT, Argentina; YerPhI, Armenia; ARC, Australia; BMWFW and FWF, Austria; ANAS, Azerbaijan; CNPq and FAPESP, Brazil; NSERC, NRC and CFI, Canada; CERN; ANID, Chile; CAS, MOST and NSFC, China; Minciencias, Colombia; MEYS CR, Czech Republic; DNRF and DNSRC, Denmark; IN2P3-CNRS and CEA-DRF/IRFU, France; SRNSFG, Georgia; BMBF, HGF and MPG, Germany; GSRI, Greece; RGC and Hong Kong SAR, China; ISF and Benoziyo Center, Israel; INFN, Italy; MEXT and JSPS, Japan; CNRST, Morocco; NWO, Netherlands; RCN, Norway; MEiN, Poland; FCT, Portugal; MNE/IFA, Romania; MESTD, Serbia; MSSR, Slovakia; ARRS and MIZS, Slovenia; DSI/NRF, South Africa; MICINN, Spain; SRC and Wallenberg Foundation, Sweden; SERI, SNSF and Cantons of Bern and Geneva, Switzerland; MOST, Taiwan; TENMAK, Turkiye; STFC, United Kingdom; DOE and NSF, United States of America. In addition, individual groups and members have received support from BCKDF, CANARIE, Compute Canada and CRC, Canada; PRIMUS 21/SCI/017 and UNCE SCI/013, Czech Republic; COST, ERC, ERDF, Horizon 2020 and Marie Sklodowska-Curie Actions, European Union; Investissements d'Avenir Labex, Investissements d'Avenir Idex and ANR, France; DFGandAvHFoundation, Germany; Herakleitos, Thales and Aristeia programmes co-financed by EU-ESF and the Greek NSRF, Greece; BSF-NSF and MINERVA, Israel; Norwegian Financial Mechanism 2014-2021, Norway; NCN and NAWA, Poland; La Caixa Banking Foundation, CERCA Programme Generalitat de Catalunya and PROMETEO and GenT Programmes Generalitat Valenciana, Spain; Goran Gustafssons Stiftelse, Sweden; The Royal Society and Leverhulme Trust, United Kingdom. The crucial computing support from all WLCG partners is acknowledged gratefully, in particular from CERN, theATLAS Tier-1 facilities at TRIUMF (Canada), NDGF(Denmark, Norway, Sweden), CC-I