There are different systems for measuring intervals in different contexts.
In tonal or traditional music, an interval is always diatonic. A fifth is always four notes (7 half steps) upward on the staff. An octave is always seven (12 half steps). A third is always two notes up, although it could be either 3 or 4 half steps, depending on whether it is minor or major. The quality (minor, major, diminished, or augmented) of the interval is always stated in terms of the interval itself, not the scale; for example, the distance from C to Eb is a minor third, even if you are in the key of Ab major.
In atonal music, intervals are measured in half steps. For example, a simultaneity containing a C and a G could be written as <0, 7> since there are seven half steps in a fifth. Chords are understood by their intervallic structure, e.g. a typical "triad" will be <0, 3, 7> and a "diminished seventh chord" would be <0,3,6,9>. (Assuming, of course, that the composer is using the common 12-step chromatic scale.) There are other systems as well, such as Forte number.