  The pseudorapidity density of charged particles with minimum transverse
momentum ($p_{\rm T}$) thresholds of 0.15, 0.5, 1, and 2 GeV$/c$ is measured in
pp collisions at the centre of mass energies of $\sqrt{s} =$ 5.02 and 13 TeV
with the ALICE detector. The study is carried out for inelastic collisions with
at least one primary charged particle having a pseudorapidity ($\eta$) within
$\pm0.8$ and $p_{\rm T}$ larger than the corresponding threshold. In addition,
measurements without $p_{\rm T}$-thresholds are performed for inelastic and
non-single-diffractive events as well as for inelastic events with at least one
charged particle having $|\eta|<1$ in pp collisions at $\sqrt{s} =$ 5.02 TeV
for the first time at the LHC. These measurements are compared to the PYTHIA 6,
PYTHIA 8, and EPOS-LHC models. In general, the models describe the $\eta$
dependence of particle production well. However, discrepancies are observed for
the highest transverse momentum threshold ($p_{\rm T}>2 {\rm\ GeV}/c$),
highlighting the importance of such measurements for tuning event generators.
The new measurements agree within uncertainties with results from the ATLAS and
CMS experiments obtained at $\sqrt{s} = 13$ TeV.
