Characterization of in-depth cavity distribution after thermal annealing of helium-implanted silicon and gallium nitride