Here is a simple and detailed explanation.
For a general reaction $aA+bB ⇌cC+dD$, $K_{eq}$ is defined as:
$$K_{eq} = \frac{(a_{\ce{C}})^c(a_{\ce{D}})^d}{(a_{\ce{A}})^a(a_{\ce{B}})^b}$$ Without going into detail, the activity "$a_X$" is basically :
- magnitude of concentration in molarity(if solution)
- magnitude of partial pressure in bar(if gas)
- $1$ (if solid or pure liquid)
Observe, the repetitive use of "magnitude". This is to emphasize that activity is a dimensionless quantity. It trivially follows that $K_{eq}$ is also a dimensionless quantity.
The above expression for $K_{eq}$ holds for any general reaction, no matter how many or which phases are involved. For example, for $aA(s)+bB(aq)+cC(g)⇌dD(l)+eE(g)+fF(aq)+gG(aq)$, the value of $K_{eq}$ is:- $$K_{eq} = \frac{(P_{\ce{E}})^e[\ce{F}]^f[\ce{G}]^g}{[\ce{B}]^b(P_{\ce{C}})^c}$$
Note here that I have taken the magnitudes of partial pressures and concentrations.
So, this in itself answers your question as to whether to take $K_p$ or $K_c$. The answer is you take neither-you simply take $K_{eq}$ which can be calculated for any reaction as explained above. This way, you'll never need to worry about taking $K_p$ or $K_c$.
Addendum: So, what's all the fuss about $K_p$ and $K_c$? Well, it so happens that sometimes you may be given the value of $K_p$ and $K_c$ for a reaction which you may need to use. Although, this is never useful over simply giving $K_{eq}$ (in my experience), it happens to be the way things are done sometimes. So, it's worth knowing a few important things about $K_p$ and $K_c$. I'll proceed by breaking down the concept into a number of small points:
- Like $K_{eq}$ , $K_p$ and $K_c$ are defined in terms of activities and are dimensionless.
- $K_p$ is typically only used when the reactants and products have only solids, pure liquids and gases(i.e. no solutions). Thus, we can say that $K_p$ is another term for $K_{eq}$ for reactions not containing solutions.
- $K_c$ can be used for any general reaction, including those with all of solids, pure liquids, gases and solutions. $K_c$ is defined as-
$$K_{c} = \frac{(a_{\ce{C}})^c(a_{\ce{D}})^d}{(a_{\ce{A}})^a(a_{\ce{B}})^b}$$ where "$a_X$"is :
- magnitude of concentration in molarity(if solution )
- magnitude of concentration in molarity(if gas)
- $1$ (if solid or pure liquid)
Observe, unlike $K_{eq}$, here "$a_X$" for gases is not magnitude of partial pressure in bar and is instead the same definition as solutions. This is also why I didn't take $a_X$ to refer to activity here, because technically "magnitude of concentration in molarity" is not the activity of a gas. This "re-definition" has the effect that $K_c \neq K_{eq}$(in general).
Now, what do we mean by "magnitude of concentration in molarity" for a gas? Well, rewriting the ideal gas equation $P_XV=n_XRT$, we get $\frac{P_X}{RT}=\frac{n_X}{V}$=[X]. so "magnitude of concentration in molarity" is $=\frac{P_X}{RT}$. So, now instead of $a_X=P_X$(in $K_{eq}$), we have $a_X=\frac{P_X}{RT}$ (in $K_{c}$). For example, for $aA(s)+bB(aq)+cC(g)⇌dD(l)+eE(g)+fF(aq)+gG(aq)$,the value of $K_{c}$ is:-
$$K_{c} = \frac{(\frac{P_E}{RT})^e[F]^f[G]^g}{[B]^b(\frac{P_C}{RT})^c}=K_{eq}(RT)^{c-e}$$
Note here, I have taken the magnitudes of partial pressures and concentrations and also the magnitude of temperature.
- We can extend the last result to $K_c=K_{eq}(RT)^{ - \Delta n_g}$ or $K_{eq}=K_c(RT)^{ \Delta n_g}$. Several sources cite that $K_p=K_c(RT)^{ \Delta n_g}$ which is true, but only when $K_p$ is valid i.e. for reactions not involving solutions. So, it doesn't show the whole picture. $K_{eq}=K_c(RT)^{ \Delta n_g}$ is true for any general reaction.We, can also see from this result that $K_c=K_{eq}$ only when $\Delta n_g=0$ which is usually seen in reactions only involving solutions but may also be seen in some gaseous reactions where the amount of gas is same on both sides.