We study the suppression of qubit dephasing through Uhrig dynamical decoupling (UDD) in nontrivial environments modeled within the spin-boson formalism. In particular, we address the case of (i) a qubit coupled to a bosonic bath with power-law spectral density, and (ii) a qubit coupled to a single harmonic oscillator that dissipates energy into a bosonic bath, which embodies an example of a structured bath for the qubit. We then model the influence of random time jitter in the UDD protocol by sorting pulse-application times from Gaussian distributions centered at appropriate values dictated by the optimal protocol. In case (i) we find that, when few pulses are applied and a sharp cutoff is considered, longer coherence times and robust UDD performances (against random timing errors) are achieved for a super-Ohmic bath. On the other hand, when an exponential cutoff is considered a super-Ohmic bath is undesirable. In case (ii) the best scenario is obtained for an overdamped harmonic motion. Our study provides relevant information for the implementation of optimized schemes for the protection of quantum states from decoherence.