A search for magnetic monopoles and high-electric-charge objects is presented using 34.4 fb-1 of 13 TeV pp collision data collected by the ATLAS detector at the LHC during 2015 and 2016. The considered signature is based upon high ionization in the transition radiation tracker of the inner detector associated with a pencil-shape energy deposit in the electromagnetic calorimeter. The data were collected by a dedicated trigger based on the tracker high-threshold hit capability. The results are interpreted in models of Drell-Yan pair production of stable particles with two spin hypotheses (0 and 1/2) and masses ranging from 200 to 4000 GeV. The search improves by approximately a factor of 5 the constraints on the direct production of magnetic monopoles carrying one or two Dirac magnetic charges and stable objects with electric charge in the range 20≤|z|≤60 and extends the charge range to 60<|z|≤100.