In a linear regression, if you assume the impact of a covariate ($X$) on a given outcome ($Y$) can be different across two different groups ($A$ and $B$), you can introduce an interaction term to evaluate whether the effect of $X$ is indeed significantly different in group $A$ vs. group $B$. For instance, we could introduce the interaction $X*D$ where $D=1$ if the observation is in group $A$ and $D=0$ if the observation belongs to group $B$
Now imagine you have two significantly different distributions for the covariate $X$ between the two groups: can you still say that with the interaction term you capture only the difference in the effect of $X$ on $Y$ between the two groups? Or is the estimate also impacted by the difference in the distribution of $X$ across the two groups? If yes, how can we disentangle between these two types of impact?