1. I've drawn a sketch of the worst case. (see attachment)
2. You get 2 similar triangles. Use proportions:
$\displaystyle \dfrac hy = \dfrac x{27}~\implies~y = \dfrac{27 h}{x}$
3. Use the Pythagorean theorem:
$\displaystyle (h+x)^2+(27+y)^2=125^2$
4. Replace y by the term of #2 and solve for h:
$\displaystyle h(x)=\dfrac{x(125-\sqrt{x^2+729})}{\sqrt{x^2+729}}$
5. Differentiate h wrt x. Solve $\displaystyle \frac{dh}{dx} = 0$ for x. You should come out with x = 36. Which means that the minimum value of h = 64.Spoiler:
I'm not sure what you mean ...(?)
1. You have $\displaystyle y = \dfrac{27h}x$ and $\displaystyle (h+x)^2+(27+y)^2=125^2$ which becomes:
$\displaystyle (h+x)^2+\left(27 + \frac{27h}x\right)^2=125^2$
$\displaystyle (h+x)^2+\left(\frac{27}{x}\right)^2 (x+h)^2=125^2$
$\displaystyle (h+x)^2=\dfrac{125^2x^2}{x^2+27^2}$
2. Can you take it from here?