Potential due to line charge: Incorrect result using spherical coordinates Context
This is not a homework problem. Then answer to this problem is  well known and can be found in [1].  The potential of a line of charge situated between $x=-a$ to $x=+a$ ``can be found by superposing the point charge potentials of infinitesmal charge elements. [1]''  Adjusting from [1] ($b\to a$), the answer to the problem below is
$$
\boxed{
\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} 
= 
\frac{1}{4\,\pi\,\epsilon_o} 
  \frac{Q}{2\, a}
\left[
\ln{\left(\frac{ a+ \sqrt{a ^2 + r^2}}{ -a+ \sqrt{a ^2 + r^2}}\right)}
\right]  \,
\,.}
$$
Yet, because I am practicing using the curvilinear spherical coordinate system,  I attempted to work this problem in that system.  I know that
$$\Phi( \mathbf{r} ) = \frac{1}{4\,\pi\,\epsilon_o} 
\int 
\frac
{
 1}
{
 \left\| \mathbf{r}-\mathbf{r}^\prime\right\|
}\rho(\mathbf{r}^\prime) \,d\tau^\prime \,$$
I also know  that
$$
\rho(r,\theta,\varphi) = \frac{Q}{2\,a} \,\frac{H{\left(r-0\right)}- H{\left(a-r \right)}}{1}\,\frac{\delta{\left(\theta-\frac{\pi}{2}\right)}}{r}\, \frac{\delta(\varphi-0) + \delta(\varphi-\pi)  }{r\,\sin\theta} \,.$$
Further, since
\begin{equation}
\begin{aligned} 
x 
&= 
r \sin\theta \cos\varphi   ,
\\
 y
  &= 
  r \sin\theta \sin\varphi   ,
  \\
z
 &= 
 r \cos\theta  ,
\end{aligned}
\end{equation}
I know   that
the expression of the distance between two vectors in spherical coordinates is given by the equation
\begin{align}
\|\mathbf{r}-\mathbf{r}^\prime\|
=
\sqrt{r^2+r'^2-2rr'\left[ \sin(\theta)\sin(\theta')\,\cos(\phi-\phi') +\cos(\theta)\cos(\theta')\right]}.
\end{align}
Finally, we are given that the obervation points, $\mathbf{r}$, are restricted as given by the equation
$$\mathbf{r} = \left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right) .$$
Putting these togehter, we have that
$$
\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} = \frac{1}{4\,\pi\,\epsilon_o} 
\int 
\frac
{
    \frac{Q}{2\,a} \,\frac{H{\left(r^\prime-0\right)}- H{\left(a-r^\prime \right)}}{1}\,\frac{\delta{\left(\theta^\prime-\frac{\pi}{2}\right)}}{r^\prime}\, \frac{\delta(\varphi^\prime-0) + \delta(\varphi^\prime-\pi)  }{r^\prime\,\sin\theta^\prime}
 }
{
\sqrt{r^2+r'^2-2rr'\left[ \sin(\theta)\sin(\theta')\,\cos(\phi-\phi') +\cos(\theta)\cos(\theta')\right]} 
} 
\,  {r^\prime}^2\,\sin\theta^\prime\,dr^\prime\,d\theta^\prime\,d\phi^\prime 
 \,.$$
Based on the point of observation, we rewrite the potential according to the equation
$$
\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} = \frac{1}{4\,\pi\,\epsilon_o} 
    \frac{Q}{2\,a} \, \int 
\frac
{
\left[H{\left(r^\prime-0\right)}- H{\left(a-r^\prime \right)  } \right] \, \delta{\left(\theta^\prime-\frac{\pi}{2}\right)} \,  \left[\delta(\varphi^\prime-0) + \delta(\varphi^\prime-\pi)  \right]
 }
{
\sqrt{r^2+{r^\prime}^2-2\,r\,r^\prime\,  \sin(\theta')\,\cos(\pi\pm \frac{\pi}{2}-\phi')   } 
} 
 \,dr^\prime\,d\theta^\prime\,d\phi^\prime 
 \,.$$
Upon taking the angular integrals I rewrite the potential according to equation
$$
\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} = \frac{1}{4\,\pi\,\epsilon_o} 
    \frac{Q}{2\,a} \, \int_0^a 
\frac
{
2 }
{
\sqrt{r^2+{r^\prime}^2  } 
} 
 \,dr^\prime 
 \,.$$
I know that
$$
\int \frac{dx}{\sqrt{x^2 \pm a^2}} = \ln{\left(x+ \sqrt{x^2 \pm a^2}\right)}
\,.
$$
Therefore,
$$
\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} 
= 
\frac{1}{4\,\pi\,\epsilon_o} 
  \frac{Q}{ a}
\left[
\ln{\left(r^\prime+ \sqrt{{r^\prime}^2  +  r^2}\right)}
\right]_0^a \,.
$$
Upon evaluation of the limits of integration, I have the incorrect result that
$$
\boxed{
\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} 
= 
\frac{1}{4\,\pi\,\epsilon_o} 
  \frac{Q}{ a}
\left[
\ln{\left(\frac{ a+ \sqrt{a ^2 + r^2}}{r}\right)}
\right]  \,
\,.}
$$
Question
The result should be identical no matter what coordinate system that I choose. I have a gap in my understanding.  Please help by  identifying and stating the error in my analysis?
Bibliography
[1] http://hyperphysics.phy-astr.gsu.edu/hbase/electric/potlin.html
 A: 
Adjusting from [1] $(b→a)$, the answer to the problem below is
$$\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} 
= 
\frac{1}{4\,\pi\,\epsilon_o} 
  \frac{Q}{ a}
\left[
\ln{\left(\frac{ a+ \sqrt{a ^2 + r^2}}{ -a+ \sqrt{a ^2 + r^2}}\right)}
\right]$$

This is wrong by a factor of 2, in the original answer they use the linear density $\lambda$, which you substituted by $Q/a$, while it should be $Q/2a$.

$$\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} = \frac{1}{4\,\pi\,\epsilon_o} 
    \frac{Q}{2\,a} \, \int_0^a 
\frac
{
2 }
{
\sqrt{r^2+{r^\prime}^2  } 
} 
 \,dr^\prime$$

From here you can use that the integrand is symmetric under the change of variables $r' \to -r'$, so you can write $2\int_0^a = \int_{-a}^a$ and the desired answer follows trivially.
Another option is to start with your final expresion $$\Phi{\left(r, \frac{\pi}{2},\pi\pm \frac{\pi}{2}\right)} 
= 
\frac{1}{4\,\pi\,\epsilon_o} 
  \frac{Q}{ a}
\left[
\ln{\left(\frac{ a+ \sqrt{a ^2 + r^2}}{r}\right)}
\right]$$
And realise that $f(a):=\ln{\left(\frac{ a+ \sqrt{a ^2 + r^2}}{r}\right)}$ is odd under the change $a\to-a$. So you can rewrite $f(a)=\frac{1}{2}(f(a)-f(-a))$. This also gives you the desired result.
