The integral is not iterated integral. Will this fact prevent us from swapping the order of surface and volume integrals? Why? Why not? Consider a continuous charge distribution in volume $V'$. Draw a closed surface $S$ inside the volume $V'$.

Consider the following multiple integral:
$$B= \iint_S       \Biggl(     \iiint_{V'}   \left[  \dfrac{\cos(\hat{R},\hat{n})}{R^2}   \rho'\   \right] dV' \Biggl)  dS$$
where
$R=|\mathbf{r}-\mathbf{r'}|$
$\mathbf{r'}=(x',y',z')$ is coordinates of source points
$\mathbf{r}=(x,y,z)$ is coordinates of field points
$\cos(\hat{R},\hat{n})$ is the angle between $R$ and normal to surface element
$\rho'$ is the charge density and is continuous throughout the volume $V'$

Since $\mathbf{r} \in S$, the function is not integrable in domain $V'$. So we use change of variables:
$$B= \iint_S        \Biggl(    \iiint_{V'}   \left[  \dfrac{\cos(\hat{R},\hat{n})}{R^2}   \rho'\ {r'}^2 \sin \theta' \right] d\theta' d\phi' dr'  \Biggr) dS$$
$\bbox[yellow]{\text{Note that in this equation, $\theta'$ and $\phi'$ are w.r.t point $\mathbf{r} \in S $}}$
The inner volume integral is an iterated integral. While computing this iterated integral in spherical coordinates (here $\mathbf{r'}$ varies and $\mathbf{r}$ is constant), we take the origin of our spherical coordinate at point $\mathbf{r} \in S$. That is, $\mathbf{r}=(0,0,0)$
Therefore after computing this iterated integral, i.e. after applying the limits, we will not be getting a function of $(r,\theta,\phi)$ or $(x,y,z)$. Instead we will be getting a number. This means we cannot carry out the surface integral by iterated integrals. Will this fact prevent us from swapping the order of surface and volume integrals? Why? Why not?

If swapping the order of surface and volume integrals is valid:
\begin{align}
B &= \iiint_{V'}        \Biggl(    \iint_S   \left[  \dfrac{\cos(\hat{R},\hat{n})}{R^2}   \rho'\ {r'}^2 \sin \theta' \right] dS   \Biggr) d\theta' d\phi' dr'\\
  &= \iiint_{V'}        \Biggl(    \iint_S   \left[  \dfrac{\cos(\hat{R},\hat{n})}{R^2}    \right] dS   \Biggr) \rho'\ {r'}^2 \sin \theta' d\theta' d\phi' dr'\\
\end{align}
$\bbox[yellow]{\text{Here in this last equation, $\theta'$ and $\phi'$ are w.r.t. which point?}}$

Special note for the answerer
This question may or may not be related to Fubini's theorem. If it is, please give the complete statement of Fubini's theorem and please show step-by-step how my question can be explained by Fubini's theorem. Please consider that I am a graduating student of Mathematics and I am learning real analysis (single and multivariable). Please try to explain within the scope of real analysis.

 A: Fubini's theorem "establishes a connection between a multiple integral and a repeated [=iterated] one".
G. Kowalewski, reviewing Fubini's 1907 paper ("Sugli integrali multipli," Rom. Acc. L. Rend. (5) 16, No. 1, 608-614), defines the theorem:

If $f(x,y)$ is integrable in a domain $\varGamma$ (in the sense of Lebesgue) and $d\sigma$ means the element of $\varGamma$, then one always has$$\int_{\varGamma}f(x,y)d\sigma=\int dy\int f(x,y)dx=\int dx\int f(x,y)dy.$$Over $\varGamma$ the condition is made that the intersection with $x$ = const. or $y$ = const. is linearly measurable (again in the sense of Lebesgue).
At the end [of his paper], the author indicates how to transfer the given theorem to polar coordinates or other coordinates.

Lebesgue integration (which is based on measure theory) is an alternative approach to Riemann integration. See Lebesgue's dissertation

*

*H. Lebesgue, “Intégrale, Longueur, Aire,” Annali di Matematica Pura ed Applicata (1898-1922) 7, no. 1 (December 1, 1902): 231–359,

which Fubini cites, or its translation in the section on Lebesgue in Hawking's God Created the Integers pp. 1207-1253.
