Given a function $\psi:\mathbb R\to \mathbb R$,
set 
$$\Psi=\psi\circ\mathrm{dist}_ {\partial M},\ \ \ \ \ f=\Psi\cdot(R-\mathrm{dist}_ p)$$
for some fixed $R>\mathrm{diam}\ M$.

Further,
$$d\,f =
(R-\mathrm{dist}_ p)\cdot  d\,\Psi-\Psi\cdot d\,\mathrm{dist}_ p$$

Thus, we may choose smooth increasing  $\psi$, 
such that $\psi(0)=0$ 
and it is constant outside of little nbhd of $0$ so that 
$\Psi$ is smooth.
(It is possible since the function $\mathrm{dist}_ {\partial M}$ is smooth and has no critical points in a small neighborhood of $\partial M$.)
Note that $d\,\Psi$ is positive muliple of $d\,\mathrm{dist}_ {\partial M}$.
Thus $d_x\,f=0$ means that geodesic from $x$ to $p$ goes directly in the direction of minimizing geodesic from $x$ to $\partial M$, which can not happen.

Now we can apply Morse theory for $f$...