Results of inclusive measurements of inelastic electron and positron scattering from unpolarized protons and deuterons at the HERMES experiment are presented. The structure functions $F_2^p$ and $F_2^d$ are determined using a parameterization of existing data for the longitudinal-to-transverse virtual-photon absorption cross-section ratio. The HERMES results provide data in the ranges $0.006leq xleq 0.9$ and 0.1 GeV$^2leq Q^2leq$ 20 GeV$^2$, covering the transition region between the perturbative and the non-perturbative regimes of QCD in a so-far largely unexplored kinematic region. They are in agreement with existing world data in the region of overlap. The measured cross sections are used, in combination with data from other experiments, to perform fits to the photon-nucleon cross section using the functional form of the ALLM model. The deuteron-to-proton cross-section ratio is also determined.