Periodic structures can be designed to exhibit elastic wave propagation band gap behaviour by varying material or geometrical properties, i.e. phononic crystals, or by periodically distributed resonators or boundary conditions, i.e. acoustic metamaterials, with various applications in passive noise and vibration control. However, variability in the manufacturing process causes material and geometry uncertainties that affect their band gap robustness and consequently their dynamic attenuation performance. In this work, the effects of slowly varying spatial properties on the vibration suppression performance of metamaterials and phononic crystals are investigated. The spectral element and the wave and finite element approaches are used for modelling the unit cells such that a wave-like interpretation can be derived for nearly-periodic structures. A beam with evenly spaced attached resonators and an undulating beam are analysed. In both cases, the band gap formation is investigated considering both non-uniform deterministic and spatially stochastic material and geometric variability. The proposed approach provides a framework to represent variability and randomness with spatial correlation of the periodic unit cell and then to assess their effects on the vibration suppression performance. It is shown that even a slowly varying spatial profile, or the correlation length in the case of random fields, plays a role on the band gap performance and that the presence of a critical section, i.e. a transition region between propagating and non-propagating waves, can significantly affect the band gap width and the amplitude of vibration attenuation. Moreover, it is shown the slowly varying approach is suitable to represent the ensemble statistics of band gaps, even considering the occurrence of such critical sections.