Continuing with your method, $$\int \frac{x^2}{\sqrt{x^2-25}}\,dx=\int \left(\sqrt{x^2-25} + \frac{25}{\sqrt{x^2-25}}\right)\,dx$$ Now $$\int \sqrt{x^2-25}\, dx=\frac{x\sqrt{x^2-25}}2-\frac{25}2\ln(x+\sqrt{x^2-25})+C_1 \tag{1}$$ using integration by parts, with $f(x)=x^2-25$ and $g'(x)=\dfrac1{\sqrt{x^2-25}}$.
Also, $$\int \frac{25}{\sqrt{x^2-25}}\,dx=25\ln(x+\sqrt{x^2-25})+C_2 \tag{2}$$ where $C_1$ and $C_2$ are constants.
Adding $(1)$ and $(2)$ together, we have $$\boxed{\int \frac{x^2}{\sqrt{x^2-25}}\,dx=\frac{x\sqrt{x^2-25}}2+\frac{25}2\ln(x+\sqrt{x^2-25})+C}$$ where $C=C_1+C_2$.
P.S. This works for all numbers, not just square numbers. In general, $$\int \frac{x^2}{\sqrt{x^2-a}}\,dx=\frac{x\sqrt{x^2-a}}2+\frac{a}2\ln(x+\sqrt{x^2-a})+C$$ for $a \in \mathbb{R}$.