This can be confusing. I'll try explaining it my way just to see if it helps, not to say that the existing answers don't already cover the answer, because they do. But this stuff can be hard to grasp.
The size of an interval is constant in all keys.
A major third is always four semitones. A major second is always two semitones. A minor second is always one semitone. A perfect fifth is always seven semitones.
The name of an interval depends on the names of the notes used to describe it
If you're trying to identify an interval, the number of semitones will always give you more than one possibility. For example, a three-semitone interval could be a minor third, but it might also be an augmented second.
You can tell by looking at the names - if the lower note of the interval is written as G, and the upper note is Bb, you call it a minor third, because G A B is three notes, three degrees of a scale (which scale doesn't matter, we know that most scales have a different letter for each degree).
If the lower note is G but the upper note is A#, it's the same pitch (in most common tuning systems) but it's now describing an interval of a minor second.
Intervals describe keys, keys do not describe intervals
In the key of G major, you know the root position first chord triad is G B D. Why? Because the root position major triad is formed out of three intervals with G as the root of them all: a unison, a major third and a perfect fifth.
In C major, the root position first chord triad is C E G, for exactly the same reason, you just build the intervals starting on C instead of G.
In Bb major, it's Bb D F, again for the same reason, but this time you're starting on Bb.
In this way, you can say what notes are in a key, what a key is, based on the intervals from the root note. Intervals tell you how to build chords, how to build harmony in a given key, using rules which really don't care what that key actually is. Sure it's different for major or minor keys - but that's because you use different intervals. D minor is still built the same as E minor or B minor or F# minor, in terms of intervals. Depending on your instrument they may sound quite different (different resonances, timbre, even the intervals coming out different due to unequal tuning), but on a theoretical basis they're all made the same.
It's easy to start interval examples on the tonic, but it's not required
Thus: a major third is a major third whether it starts on the tonic of your current key or not.
C to E is a major third in C major, but also in D major and in A major and in F major and in F# minor. Now, you may not be very likely to see a C natural in D major seeing as how there's a C# in the key signature, but if you did C->E would be a major third, even though it starts on the key's flattened leading note.
If your head hurts a bit, that's normal
My brain melted when I first learned this. It's perfectly normal, and one of the reasons why people doing ABRSM music exams dread hitting the point where they're required to sit their Grade 5 Theory to progress in the instrumental exams.