Depending on your location, walking up to people really isn't all that weird. For me, I've been in rural and suburban areas and the community there can be a lot more open and outgoing, leading to people frequently striking up chats with you.
But those places aren't really the norm. So, in that case, I'd suggest joining any community events, if your place has any? I don't know much about urban areas but in my suburban town, there's always fliers promoting some event, whether that's a local music festival, a clean-up crew, an art festival, sewing club, etc. I've really only been to the art festivals and, I mean, the conversations there can be a bit limiting since those festivals are places that sell things and a seller may not want to spend time just chatting lol but I have had some long talks with some artists, either way. Getting involved with your community opens up a lot more opportunities for you to meet new people and regularly meet up with them, if you're actively involved. If you're in a city, I'd think hanging around social areas such as clubs/bars would have a similar effect...? Then again, I've never been to one LMAO so take that with a grain of salt. I think urban areas probably have local events too anyway, if there's that many people in an area.
Heck, you could even go the online route and make a Facebook account or something and join your community's online group (if it exists). I...don't know much about Facebook but a lot of my family members (in their 30s) seem to make a lot of connections that way. It's a bit similar to my ofher suggestion, since local events can also be posted online along with any local help needed among the people there, but apparently some people can just...chat with other people there so...there's that!
I will say, I absolutely suck at making friends in general, even at school/work. However, I do genuinely believe that getting involved in your community is a valid way to socialize ¯\_(ツ)_/¯