I am wondering for when there is a white to white note transition (E to F, B to C) is there a change in the way I mark an interval compared to how I have been taught so far, basically that the staff is a perfect grid that you can look 2 lines up and say that's a 5th etc etc. If it is that way, why does it work? I find this to be paradoxical . If it doesn't work like that can you please lay out for me how it does work?
The intervals are contextual, with potentially different naming depending on if you are describing them melodically (the distance between one note and the next) or harmonically (the note distances related to a specific chord structure).
The staff isn't a perfect grid, you still have to take into account the whole step letters and half step letters when figuring out the interval, for example when you go up from B to F it will look like a fifth (skip a line) but the actual steps work out to a tri-tone.
Below is a list of basic intervals, "m" is minor, "M" is major and P is perfect. Perfect and major intervals can be raised up a half step by augmenting them. Perfect and minor intervals may be lowered a half step by diminishing them.
The one and 8 can be considered a perfect interval as well, not having a major or minor version.
Starting from your lower note as 1, you would count up the half steps to your higher note to find the interval.
If you are describing chord structure then the interval is defined by its position in the chord. For example, the tri-tone can be described as an augmented 4th, but if it is taking the place of the fifth in a chord you would call it a diminished 5th instead. If I add a D note to a C chord it isn't a 2nd, but instead called a 9th because the thirds have to stack through C E and G first to complete the chord, then you add the later intervals (7, 9, 11, and 13).
It works because of how staff notation was designed and what an interval measures in general. Let's just look at the treble staff real quick:
As you can see, each line/space on the staff has a defined letter name that resided there. The second line of a treble clef will always be some kind of G no matter what accidentals are applied to a note there and the space above it will always contain some kind of A and below it will be some kind of F. The rest of the staff continues this patter and enumerates the notes A-G.
An interval is a measurement of two things: the distance between the letter names of two notes and the distance in semitone of two notes. Because of how letters names always lie on the same spot and distances are always the same letter name distance(i.e. one space to the next space up will always be a 3rd, one line to two lines up will always be a 5th, ect.).
Note that the quality of the interval will not always be the same because the distance in semitones may not be the same. For example G to D is a Perfect 5th, but B to F is a diminished 5th.