You should know if it is a half step or a whole step by what the notes are, not by the distance between them. For instance if you go from a G to an A then that is a whole step. Or from G to G# which is a half step.
"...I just want to know when, by looking at two notes, it would be a whole step vs a half step..."
You have to learn the piano keyboard and you always have to consider your key signature to determine if it's a whole or a half step between any 2 notes. And you eventually have to learn the pattern of whole and half steps in the major and minor scales and the pattern of intervals contained in various chords.
So, in your example, the first two notes are C and D. Visualizing the piano keyboard, this C would be middle C and this D would be a whole step above middle C. There are no sharps or flats in the key signature, so it's a C natural and a D natural. Whole step.
The next two notes are D and Eb. Visualizing the piano keyboard, this D and Eb are right next to each other, white note D and black note Eb. Nothing in the key signature, so it's a half step.
It's always a half step between white notes E and F natural and between white notes B and C natural (no black keys between them). Otherwise, whole step between white notes.
It's a lot to keep in mind, but as you get more experience, it'll all start falling into place without having to think about it.
Your example is a melodic minor scale, in which the pattern of whole steps and half steps when the scale is ascending is different from the pattern when the scale is descending. One more thing to remember...