Fetch value from URL?

How can I fetch the value that comes after tags/value.html

The URL: example.com/tags/value.html since the value is always different how can I take it and convert into PHP value I can use in SQL query to search for similar posts!

I can’t use $_GET because I want the URL to be SEO friendly can’t use tags.php?tag=value