Contrary to what is taught in high school, the equilibrium constant K (and likewise the reaction quotient Q) are unitless. It is implicitly understood that all of the concentrations [A], [D] ... etc. are all divided by something called the "standard concentration" which is equal to exactly 1 M. This cancels out all units you would get from [A], [D] ... etc. and thus K (and Q) are unitless.
And this isn't some trivial formality, either! Certain equations involve that K or Q place them inside logarithms, and units inside logarithms is undefined. An example of such an equation is [tex]\Delta G^o = -RT\ln{K} [/tex] So in short, you don't need to worry about units at all, and as you mentioned, only reactants/products in the gaseous (g) or aqueous (aq) phase are accounted for in the mass action equation.
Regardless, if you have a factor with identical units in both the numerator and denominator, they would cancel out either way.