There are three ways in which the function $f$ depends on $x$, and the derivative contains one term for each of them:
\begin{eqnarray} f'(x) &=& -\frac1{(x+1)^2}\int_x^\infty g(r,x)\mathrm dr \\ &&+\frac1{x+1}g(x,x) \\ && +\frac1{x+1}\int_x^\infty\frac{\partial}{\partial x}g(r,x)\mathrm dr\;. \end{eqnarray}
[Edit in response to the comment:]
I'll assume that you meant $g(r,x) = \exp(-r^2) (r-x)^{-1/2}$, since the version with a $t$ in the denominator wouldn't cause problems at $r=x$.
In such a case, you could obtain a result by replacing the lower bound of the integral by $x+\epsilon$; then two of the terms would go to infinity as $\epsilon\to0$, and you could cancel them before taking that limit. However, a simpler approach would be to substitute:
$\frac1{x+1}\int_x^\infty \frac{\mathrm e^{-r^2}}{\sqrt{r-x}}\mathrm dr=\frac1{x+1}\int_0^\infty\frac{\mathrm e^{-(u+x)^2}}{\sqrt u}\mathrm du\;.$
Now the bound doesn't depend on $x$, and the integral of the derivative of the integrand with respect to $x$ is well-defined. Of course you can always make this substitution, but unless $g(r,x)$ contains $r-x$, it just rearranges the terms without reducing the work.