We prove generalized Fefferman-Stein type theorems on sharp functions with $A_p$ weights in spaces of homogeneous type with either finite or infinite underlying measure. We then apply these results to establish mixed-norm weighted $L_p$-estimates for elliptic and parabolic equations/systems with (partially) BMO coefficients in regular or irregular domains.