First, I will set the scene: suppose $M$ is a compact connected smooth manifold equipped with a Riemannian metric. The Hopf-Rinow theorem guarantees that any two points $x,y\in M$ can be joined by a geodesic, and of all the geodesics joining $x$ and $y$, at least one is a shortest path from $x$ to $y$.
Now here is what I am trying to prove. Let $p\in M$. I want to show that there is a neighborhood $U$ of $p$ such that if $x,y\in U$, I can extend a shortest-path geodesic from $x$ to $y$ to a third point $z$ so that the path is also a shortest path from $x$ to $z$. The Hopf-Rinow theorem guarantees that the geodesic from $x$ to $y$ can be extended past $y$, but how can I guarantee that the geodesic continues being the shortest path for even just a little bit?