When studying various philosophers I find that many of their teachings come from 3rd parties years after their supposed death's. Not to mention many of their discourses and experiences (e.g. Diogenes encountering Alexander the great) can seem somewhat fantastical and fictional. It gives me an impression that these men may have not existed the way we know it but rather future philophers used these men as characters in teaching various schools of thought.
Socrates himself would counsel us (via Plato’s Apology) that “what I do not know I do not think I know either”: the point of the quote being a humility around knowledge. There are many things about Ancient Greek philosophers that we simply do not know, simply because we have a very imperfect and incomplete record of their philosophising. Many modern books have been written about the tiny, disjointed scraps of philosophy left behind by the pre-Socratic philosophers, most of which make a mountain out of a molehill. A lot of the time, our knowledge of figures like Diogenes or Thales or Anaximander is either based on a) scraps mentioned in passing by other philosophers, or b) is based on a 3rd century AD book by Diogenes Laertius which is frequently gossipy, quite credulous, and frustratingly shallow in its understanding of the philosophy.
That said, for Socrates himself, while we should be careful making claims about what we definitely know for certain, it is extremely likely that he was a real historical figure. He is caricatured in Aristophanes’ play The Clouds, he is the central character in a large amount of dialogues written by the philosopher Plato and several dialogues written by the historian/soldier Xenophon. These all basically portray Socrates as a real historical figure who was in the habit of talking to other real historical figures in Athens (though there is traditionally thought to be a divide in Plato’s writing between the earlier dialogues that are more faithful to Plato’s understanding of what Socrates argues, and the later dialogues that are more clearly Plato putting words in Socrates’ mouth).
Perhaps most convincing about Socrates’ existence, in a funny way, is the very different Socrates characters that appear in Plato, Xenophon, and Aristophanes. Aristophanes’ caricature of Socrates is from when Socrates was still alive, and the humour in the play often fairly clearly derives from its ability to parody the kind of crap Socrates would say, as far as the average Athenian would understand. Aristophanes presents Socrates as a sophist of sorts, a glib, unworldly weirdo, and it’s fair to say that a bunch of the comedy comes from tearing down a public figure, along the lines of every comedian doing Bill Clinton jokes and impersonation in the 1990s.
Plato’s version of Socrates is the famous one - that’s where you hear Socrates say things like 'the unexamined life is not worth living’ and practicing the Socratic method on unsuspecting Athenians in the agora. And it seems likely that Plato’s writing about Socrates was to some extent originally motivated by trying to rehabilitate Socrates’ reputation and explain what the philosopher was really about and what he really argued; Plato clearly attempted to put forth the idea that the unfair caricature of Socrates put forward by Aristophanes played a role in Socrates’ trial and death.
In contrast to Plato’s high philosophy Socrates, Xenophon’s Socrates is portrayed quite differently, as an eminently sensible wise man of the era, with lots of useful, positive advice. But Xenophon’s Socrates nonetheless meets the same fate as Plato’s Socrates - the trial and death - for relatively similar reasons; the two accounts, read together, read like two different accounts of real events by people with different biases.
Having three separate writers all write about the same philosopher in quite different ways and contexts (either during his life or relatively soon after) is pretty good evidence for Socrates’ existence - given how few primary sources survive from the era, we basically have more legitimate primary sources about Socrates than we have for most ancient figures.
What we know of Diogenes of Sinope, in contrast, largely comes from Diogenes Laertius, who wrote hundreds of years later, though Plutarch relates the Alexander the Great story many years earlier than Laertius. Diogenes Laertius isn’t particularly reliable - he ascribes a lot of later philosophy to Pythagoras, because Pythagoras’ followers had a tendency to assume that all philosophy flowed from Pythagoras and gave him credit for plenty of stuff he never said, and Laertius wasn’t enough of a critical thinker to question this. But Diogenes has access to plenty of sources we do not, and credulous as he was, he’s likely reflecting ancient beliefs about the lives of eminent philosophers. The story about Diogenes meeting Alexander is likely apocryphal, meant to illustrate something about Diogenes’ philosophy, but there may also just be elements of truth in Laertius’ portrayal. Ultimately we have to trust Laertius on a lot - but that’s the nature of doing history; we can’t just say we know things because some ancient writer said it was that way. We have markedly imperfect sources of information, and we need to carefully interrogate a text...but as imperfect as Laertius is, the existence of his writing is something, and we can have guarded assumptions about where his account is closer to the truth and where it is telling a good story.