If you know someone's Fediverse address, you can follow them by searching for that address in Mastodon's search box and then clicking on "follow" on the result.
Fediverse addresses look like this:
@ (username) @ (instance name)
You can find Fediverse addresses on every Mastodon profile page, just under the username.
Alternatively, you can search for a profile's URL, or even a post's URL. These will force your instance to display that URL's profile page or post so you can interact with them.
Also, all of these work with Fediverse addresses and URLs from non-Mastodon platforms too!
For example, you can interact with a PeerTube video within Mastodon by searching for that video's URL. The video will appear as a Mastodon post, but it is still the same video and replying to that post within Mastodon will create a comment on the video's PeerTube page.