Measurements of the production of electrons from heavy-flavour hadron decays in pp collisions at s√ = 13 TeV at midrapidity with the ALICE detector are presented down to a transverse momentum (pT) of 0.2 GeV/c and up to pT = 35 GeV/c, which is the largest momentum range probed for inclusive electron measurements in ALICE. In p-Pb collisions, the production cross section and the nuclear modification factor of electrons from heavy-flavour hadron decays are measured in the pT range 0.5 < pT < 26 GeV/c at sNN−−−√ = 8.16 TeV. The nuclear modification factor is found to be consistent with unity within the statistical and systematic uncertainties. In both collision systems, first measurements of the yields of electrons from heavy-flavour hadron decays in different multiplicity intervals normalised to the multiplicity-integrated yield (self-normalised yield) at midrapidity are reported as a function of the self-normalised charged-particle multiplicity estimated at midrapidity. The self-normalised yields in pp and p-Pb collisions grow faster than linear with the self-normalised multiplicity. A strong pT dependence is observed in pp collisions, where the yield of high-pT electrons increases faster as a function of multiplicity than the one of low-pT electrons. The measurement in p-Pb collisions shows no pT dependence within uncertainties. The self-normalised yields in pp and p-Pb collisions are compared with measurements of other heavy-flavour, light-flavour, and strange particles, and with Monte Carlo simulations.