We study the time dependence of the decoherence factor (DF) of a qubit globally coupled to an environmental spin system (ESS) which is driven across the quantum critical point (QCP) by varying a parameter of its Hamiltonian in time t as 1−t/τ or −t/τ, to which the qubit is coupled starting at the time t→−∞; here, τ denotes the inverse quenching rate. In the limit of weak coupling, we analyze the time evolution of the DF in the vicinity of the QCP (chosen to be at t=0) and define three quantities, namely, the generalized fidelity susceptibility χF(τ) (defined right at the QCP), and the decay constants α1(τ) and α2(τ) which dictate the decay of the DF at a small but finite t(>0). Using a dimensional analysis argument based on the Kibble-Zurek healing length, we show that χF(τ) as well as α1(τ) and α2(τ) indeed satisfy universal power-law scaling relations with τ and the exponents are solely determined by the spatial dimensionality of the ESS and the exponents associated with its QCP. Remarkably, using the numerical t-DMRG method, these scaling relations are shown to be valid in both the situations when the ESS is integrable and non-integrable and also for both linear and non-linear variation of the parameter. Furthermore, when an integrable ESS is quenched far away from the QCP, there is a predominant Gaussian decay of the DF with a decay constant which also satisfies a universal scaling relation.