I am attempting to find the energy stored in assembling an spherical shell (denoted by $S$) uniformed distributed of total charge $q$, and radius $R$. To do so, I want to use the formula: $$W = \frac{1}{2} \epsilon_0 \int_{\text{S}}\sigma V da$$
The problem comes when I try to calculate $V$. Using Gauss's law to find $E$ and then $V$, it's easy to see that $V = \frac{q}{4\pi \epsilon_0 R}$ on the surface of the sphere. However when I try to calculate $V$ using an integral method, the integral diverges. The formula for $V$ is $$V = \frac{1}{4\pi \epsilon_0} \int_S \frac{\sigma}{|\vec{r}-\vec{r}\hspace{1pt}'|} da'$$
where $\vec{r}$ is the location of $\rho$ and $\vec{r}\hspace{1pt}'$ is the position of the the other charges which affects $\rho$. One can see that this integral diverges, which makes sense because we are assuming an continuous charge distribution, which means $|\vec{r}-\vec{r}\hspace{1pt}'| \to 0$.
I don't understand why this is? Using this integral methods, we should still arrive at the same answer as the Gauss's law method. Could someone please explain why this doesn't work/or a way to get around this issue?