The short answer is, yes, you can do that in Anvil.
You don’t say what you’ve already tried, or what you’re using for your app. So I can only give general advice. Look at the Anvil Extras routing module: Routing — Anvil Extras documentation
That gives each main form in your app a distinct URL. You can use that to work out which user’s profile page a particular URL should display, and display that user’s profile.
If you haven’t used routing before, it requires a major change in how you navigate from form to form, but it’s worth it. I wouldn’t write an app without it.
Here’s a sample app that uses hash routing and shows how to manage login/logout with it: Anvil | Login