Yes, this is possible, lots of people have deep friendships online. I have personal experience with this because I was homeschooled for many years and didn't have many opportunities to make friends in person, so I made friends online. I still talk to some of those people today, some of them attended each other's weddings, etc. I've also turned to it again as an adult due to the pandemic, so I can say from experience this works.
The best way to find an online friend is actually similar to how you'd find one in real life: find a place to do an activity you enjoy with other people. It provides a built-in conversation starter, so things are more natural and less awkward. If you participate regularly and the group is a good fit then you'll generally make friends naturally. If the group isn't a good fit (maybe they're really rowdy and you're more quiet or they're very casual about the activity and you want to be competitive), then find a new one. There are tons of options, so don't feel stuck in the first one you find.
So what kind of activities can you find online? The two big categories in my experience are playing games and discussing something. Games are great because they provide a shared experience, and if nothing else, you'll have fun playing the game. Discussing any topic of interest can work too, if you're not a big gamer. There are discussion boards for every topic under the sun: cars, politics, current events, sports, stamp collecting, you name it. Reddit, Discord, and Facebook are all popular places for people to chat, and there are countless others if you don't like any of those. Just Google your topic + discussion and you'll probably find something. Even Stack Exchange has a chat function which you could use to meet people. The specific site you use isn't that important.
I suggest you steer clear of any apps specifically designed to meet people. Even if they say they're for friendship, people use them almost exclusively for hookups, That's fine if that's what you want, but you're not likely to make a faraway friend that way. Plus it's harder to find people who share your interests. Trust me, I've tried them.
Good luck!