$L^p$-Square Function Estimates on Spaces of Homogeneous Type and on Uniformly Rectifiable Sets