The UNION allow you to find things that have a URI and those that have a URI via a redirect before then applying the rest of your query. Note I also changed your FILTER to use SAMETERM() which should make the query faster.

In general if you have this kind of query where you are doing that sort of a FILTER to set a constant I would strongly suggest just replacing all uses of the ?uri variable with <URL> instead which should see much better performance