Knowing the base sides and the slant heights, do we calculate the height of the pyramid by the formula $h^2=h_b^2-\left (\frac{a}{2}\right )^2$, no matter what shape the base of the pyramid has, i.e. square, rectangular, right angles triangle?
For example having the pyramid with base right angles triangle with the base measurements: $a=6mm, \ b=8mm, \ c=10mm$ and with slant heights $h_a=1.2cm, \ h_b=1.17cm , \ h_c=11.3mm$, do we use the above fomula to calculate the height?
No. The formula comes from Pythagorean theorem applied to the right triangle formed by the height of the pyramid and height of one side of the pyramid. The leg of the right triangle lying in the base depends on that base. In the case of regular square pyramid, this leg is $\frac a2$, where $a$ is the length of squares side.
Have you tried drawing a picture?