This paper presents a search for hypothetical massive, charged, long-lived particles with the ATLAS detector at the LHC using an integrated luminosity of 139 fb$^{-1}$ of proton-proton collisions at $\sqrt{s}=13$ TeV. These particles are expected to move significantly slower than the speed of light and should be identifiable by their high transverse momenta and anomalously large specific ionisation losses, ${\mathrm{d}}E/\mathrm{d}x$. Trajectories reconstructed solely by the inner tracking system and a ${\mathrm{d}}E/\mathrm{d}x$ measurement in the pixel detector layers provide sensitivity to particles with lifetimes down to ${\cal O}(1)$$\text{ns}$ with a mass, measured using the Bethe--Bloch relation, ranging from 100 GeV to 3 TeV. Interpretations for pair-production of $R$-hadrons, charginos and staus in scenarios of supersymmetry compatible with these particles being long-lived are presented, with mass limits extending considerably beyond those from previous searches in broad ranges of lifetime.