Strictly speaking, equilibrium constants are determined by activity coefficients, not concentrations. This makes sense in principle, because not all reactions happen in solution, yet equilibrium still exists. So there must be some broader definition than one based on concentrations.
The activity coefficient is kind of a measurement of the relative potential (in terms of chemical energy) of a substance to make some transformation. The equilibrium constant defines the state of a mixture based on all these potential energies. The "relative" is important in this definition - we don't use actual activity values but rather express the activity coefficient as the ratio of the activity of the substance in the state of interest to its activity in a standardized state. You should know by now that thermodynamic quantities are almost always determined relative to something else. Activities are no different.
For solutes in solution, the standard state is defined as being the solute dissolved at a concentration of 1 M, so the activity coefficient (for ideal solutions) is the observed concentration divided by the concentration of 1 M. Therefore the activity coefficient of a dilute solute is proportional to its concentration - which is why for solution-based reactions we can usually get away with quickly redefining the equilibrium constant in terms of the concentrations rather than the activity coefficients.
The standard state of a bulk solid or liquid is defined as the pure solid under a certain atmospheric pressure. Solids and liquids produced or consumed in most reactions you encounter in solution chemistry are already assumed to be in their standard states, therefore their activity coefficients are by definition 1. In this sense they "don't affect the equilibrium".
In general chemistry we are often taught that "all solids and liquids are given a value of 1 in an equilibrium constant expression". In practice this is usually OK but keep in mind that it is not always true, just as it is also not always true that we can get away with using concentrations in place of activity values for solute reactants and produces. In cases where solutes do not behave ideally, the concentration is not proportional to the activity value, so activities must be used in place of concentrations in these cases. Electrochemistry or high ionic strength solutions are examples where this is important. And a value of 1 for a solid or liquid is only appropriate when the solid or liquid is in its standard state. Transformations that involve conversion of a pure solid to another form or allotrope (e.g., diamond to graphite) require the usage of activity values in the equilibrium expression because obviously both diamond and graphite cannot both be the standard state of carbon. Likewise if a reaction occurs at very high or low pressure pure solids and liquids are no longer in their standard states, so a value of 1 would not be appropriate in the equilibrium expression.