Welcome to the Prismic community.
Well, in fact, the solution depends on the technology you are using, but that is totally possible.
Basically, in SSR (Server-side Rendering), when you make a server-side query with an old UID, you will still get the document from Prismic.
So all you need to do is check to see if the UID you used to make the query matches the one returned from Prismic. If so, then render the page. If not, then redirect to the URL that uses the current UID.
It works the same for SPA (client-side rendering), and here’s a thread on the forum about it:
For SSG (Static Site Generation), the website should redirect to the correct page when you use the old UID. That basically involves running a query live if the UID is not in the static list. It searches the API and returns the document with the old UID. If the UID doesn't exist anywhere, the standard 404 is returned.
You can read more about his in this thread on the forum.
Please let me know if you need any more info,