there's several explanations for this:
1. more people have mental illnesses simply because there are more people. the population grows every year, and there's no limit on how many people can have mental illnesses, thus, their numbers grow. genetics can cause illnesses or can cause people to be preidsposed to developing them later. as society adapts for disabled and mentally ill, they survive and have kids. basic population genetics.
2. internet and more normalized global communication makes it very easy to recall examples of people with mental illnesses. if we didn't have internet, i could count on one hand the number of people i know with diagnosed disabilities. with the internet, i can think of at least 100 usernames.
3. better diagnostic criteria allows for more people to be diagnosed when they would have previously gone undiagnosed. example: the symptoms of adhd and autism listed in the dsm were mostly indicative of boys' behavior, causing many girls to fall through the cracks, therefore less diagnoses in past. mainly, adhd was thought to be a hyperactive disorder, but many girls don't show hyperactive symptoms and would therefore not have received any diagnosis in the past (source: me).
4. mental illnesses are coming out of the shadows and becoming a more open part of society. people could now be more likely to share their diagnoses. it's quite possible that you knew mentally ill people before, but they just didn't bring it up. example: i would never tell people of my diagnosis in real life, but now that conversations around mental illness are somewhat common, i feel more comfortable.
4.5. when mental illnesses become more prevalent, more people see those symptoms and think "hey, that could be me" and seek help. source: me. i thought everybody occassionally had moments of debilitating anxiety. i never would have gone to a doctor had i not know they were a potential sign of mental illness and could be treated.
5. internet is somewhat anonymous. i, and probably other people as well, feel more comfortable sharing, therefore it appears like more people are diagnosed.
6. the way society is built can cause some mental illnesses to stand out and might actually be causing more people to develop them. if i lived on a farm 300 years ago, my adhd wouldn't be as noticeable or maybe people wouldn't care. now, if you're unable to sit still and memorize material for 7 hrs/day, it stands out. for example: there's studies that show that the insane amount of work causes insane amount of stress which can result in depression. look at japan. i can link studies later.
it's likely a combo of all of these things. i'm not saying everyone you see has a mental illness, in fact, we still normalize using mental illnesses as mood descriptors (ocd, autism, etc), which can cause the illness to be misunderstood by people who don't seek a professional's opinion.
also, it's very harmful to base someon's outward appearance or behavior on a single judgment. people are legitimately denied care and harmful behaviors by the public are perpetuated by this "but you look/seem fine" stereotype. i totally understand where you're coming from, though, but because of this mindset I used to deny my own health because i "seemed" functional. like it's totally fine to assume someone isn't mentally ill or disabled by appearance (it's impossible to tell from outside most of the time), but if someone tells you they have a diagnosis, think about what you're saying when you are denying it. nobody knows what it's like to be you just how you can't know what it's like to be the other person just by looking.
i hope i could explain this as best as possible to help you understand, i am not trying to be rude at all, this issue is just something that personally affects me daily