Site icon Hip-Hop Website Design and Development

How to get a page url segment on wordpress?

I’ve created a regular wordpress page named "user" which is using a custom template.
This page is supposed to be called like so:
www.site.com/user/<ID>

Is it possible to get the ID segment of the URL programmatically?
The goal is to show the details of the user that belongs to the given ID.

When testing, that part of the URL is always removed.
If I request the URL
www.site.com/user/123
the page is redirected to:
www.site.com/user

Thanks in advance.