I guess it also partially depends on the games you play. I never made any kind of connection while playing Dota 2 for example.
In Fear multiplayer and then Bad Company 2 I was often meeting people from one particular clan, they happened to be from same country and asked me to join them. Being in a clan surely allows to get to know other players better and I still have contact with some of them. In StarCraft 2 I sometimes would ask my opponent for advice after game or get asked myself and sometimes it does lead to practicing and talking about stuff.
Discord's communities are now certainly a way to go. Personally I would recommend smaller, more focused ones than big servers with hundreds or thousands of people.
Almost every online friend I have was made in Dota2 actually. I don't have anyone from IRL playing it. But it kinda goes with failure and retrying. Find some rando in a game you like in that game, add him as a friend, if he (or she) accepts, play another game. If it keeps fun eventually you may become friends. That's how I met my first few friends. Then via them I started meeting more and more people and now I play with a stack that are not at all related to the first few friends I made.
Point being, if you play a game and you like someone in it, just add him / her because you might never run into them again. Then play another (few) games and see if they're still fun. And if they don't, don't play with them anymore, you'll meet someone else.
Besides Discord communities can be fun, but from all Discords that I'm in and that are not owned by friends, I made few friends. Some people I like for sure but I don't really play with any of them. Also, if you want to join a smaller community you need to know which one exactly. "PC Gamer" for example would be pretty general, but would you join a Dota2 Discord, there are alot of them and I'm sure far from all of them are nice.