Are there issues to taking the intersection of two datasets for running a regression? I have two datasets $D_1$ and $D_2$, of size $m$ and $n$. Suppose that $D_1$ contains the heights of people and $D_2$ contains the weight of people. Each dataset is indexed by a unique identifier and it is the case that not all the individuals in $D_1$ are in $D_2$.
In order to run a regression, I then find the intersection of individuals who are in both $D_1$ and $D_2$, creating subset $D'_{1}$ and $D'_{2}$. If I then run a linear regression where
$$
D'_{1} = \beta_0 + \beta_1D'_{2}+\epsilon
$$
are there any issues I might run into? Intuitively it seems like I am artificially selecting the individuals who will be in the regression. However, if I can assume that the event two individuals are in both datasets is random, would it be valid?

The primary issue you need to consider here is the sampling scheme that led you to have partial data on each variable.  In particular, you need to consider whether the "missingness" in the data is "at random" or if it is statistically related in some way to the variables at issue.  I recommend you look up some statistical literature on informative sampling and the concept of variables that are "missing at random".
