Semiparametric KSD test: unifying score and distance-based approaches for goodness-of-fit testing