How to avoid catastrophic cancellation Bessel Integrals

Recently, I needed to evaluate some integrals involving linear combinations of J_m and Y_m. There are well-known analytical expressions for those, which are

However, I am finding that when \alpha and \beta are very close, and for certain m, like m=7, I think I am getting catastrophic cancellation since the results are completely wrong. A comparison with QuadGK confirms that indeed the results are wrong.
Also, the results for \alpha \approx \beta should get really close to the \alpha = \beta case, which should be 1 since I am working with an orthonormal basis.

What could be a good strategy to alleviate this issue? I would like to keep using the analytical expression since it is much faster.

Have you tried integrating over the difference δ = α-β starting from zero? Since you know δ = 0 you can write the result as a definite integral… sometimes this works. At least you will get a taylor expansion which may be accurate at the scale when the cancellation becomes problematic.