  Given two closed subsets $X, Y$ in $\mathbb{R}^n$, we construct a version of
Morse Theory for $\mathrm{dist}_Y|_X \colon X \to \mathbb{R}$, the restriction
to $X$ of the Euclidean distance function from $Y$. We use the notion of
critical points of Lipschitz functions introduced by Clarke and apply the more
general Morse Theory of continuous selections, as presented by Agrachev,
Pallaschke, and Scholtes. In this framework, nondegenerate critical points have
two indices: a quadratic index as in classical Morse Theory, and a piecewise
linear index that relates to the notion of bottlenecks.
  This framework is flexible enough to simultaneously treat two cases of
interest for computational algebraic geometry: the Bottleneck Degree (BND) and
the Euclidean Distance Degree (EDD). We provide bounds on the number of
critical points of $\mathrm{dist}_Y|_X$ when $X$ and $Y$ are generic real
algebraic hypersurfaces and relate these bounds to the BND and EDD. We also
prove a duality formula relating the Euler Characteristics of $X$ and $Y$ with
the number of critical points of $\mathrm{dist}_Y|_X$ and $\mathrm{dist}_X|_Y$,
respectively.
  Moreover, we introduce a technical toolset of independent interest, which
guarantees that our Morse Theory can be used in the generic algebraic case.
