  The current upper limit on $N_{\rm eff}$ at the time of CMB by Planck 2018
can place stringent constraints in the parameter space of BSM paradigms where
their additional interactions may affect neutrino decoupling. Motivated by this
fact in this paper we explore the consequences of light gauge boson ($Z'$)
emerging from local $U(1)_X$ symmetry in $N_{\rm eff}$ at the time of CMB.
First, we analyze the generic $U(1)_X$ models with arbitrary charge assignments
for the SM fermions and show that, in the context of $N_{\rm eff}$ the generic
$U(1)_X$ gauged models can be broadly classified into two categories, depending
on the charge assignments of first generation leptons. We then perform a
detailed analysis with two specific $U(1)_X$ models: $U(1)_{B_3-3L_e}$ and
$U(1)_{B_3-3L_\mu}$ and explore the contribution in $N_{\rm eff}$ due to the
presence of $Z'$ realized in those models. For comparison, we also showcase the
constraints from low energy experiments like: Borexino, Xenon 1T, neutrino
trident, etc. We show that in a specific parameter space, particularly in the
low mass region of $Z'$, the bound from $N_{\rm eff}$ (Planck 2018) is more
stringent than the experimental constraints. Additionally, a part of the
regions of the same parameter space may also relax the $H_0$ tension.
