In quantum electrodynamics, the vacuum is not empty but has fluctuating fields which cause an orbiting lepton (electron or muon) to deviate from its quantum orbit and as a result, weaken its coupling with the nucleus, thus causing small changes in lepton energy states. Therefore, in this study, the quantum electrodynamics theory is then applied to determine qualitatively the mean square positions of an oscillating lepton by taking into account the vacuum fields and nuclear size effects. The first-order time-independent perturbation theory as an approximation method is applied to solve for the small changes in the nuclear lepton interaction caused by the two effects. The general expression that can be applied to calculate the changes in lepton energy states is deduced and then applied to calculate numerically these effects on the energy states of single-electron and single muonic atoms. The results showed the dependence of these effects on the principal quantum number n, the orbital quantum number l, the azimuthal quantum number m and the proton number Z. A more significant effect on s (l = 0) states of the large atomic nucleus and muonic atoms is observed. The obtained energy level corrections can be considered as additional energy level corrections that have to be investigated for reanalyzing the existing measured nuclear structure effects and for comparison with future spectroscopic investigations. Moreover, the new proposed formula would be suitable for calculating the energy level corrections in both muonic and electronic atoms caused by the fluctuating vacuum fields.