The standard model conserves lepton flavor and lepton flavor universality although these do not follow
from an underlying gauge symmetry. However, the discovery of neutrino oscillations and anomalies observed in B-meson decays indicate violation of lepton flavor and lepton flavor universality, respectively. Various scenarios beyond the standard model have been studied extensively by different experiments at the LHC. This talk presents recent searches for a new Z' boson predicted in the context of lepton flavor violation and lepton flavor universality violation models. The searches use a 13 TeV $pp$ collision data sample, collected by the CMS experiment at the CERN LHC.