An interval has two properties. The first is the interval number and the second is the interval quality. The names of the intervals reflect that. For example, for a "perfect fifth", the interval number is "five" and the interval quality is "perfect". Similarly, for a "major third", the interval number is "three" and the interval quality is "major".
Interval numbers count the scale degrees, including both the first and the last note. So the interval number of the interval between a C and the G above it is five, since you count five scale degrees: C D E F G.
Interval qualities tell how many chromatic steps there are between the two notes. For fourths, fifths and octaves (eighths), 5, 7, and 12 semitones respectively (this time not counting the first note) are called "perfect" fourths, fifths, and octaves. So, the C-G interval is a perfect fifth, because it involves five scale degrees (hence fifth) and seven semitones (hence perfect according to the previous definition).
For these intervals (4, 5, and 8), if the interval is one semitone smaller than perfect, its quality is "diminished". If it's larger by one semitone, it's "augmented". So, the B-F interval is a "diminished fifth" because it involves five scale degrees but only 6 semitones. On the other hand, the F-B interval is an "augmented fourth" since it involves four scale degrees but it's 6 semitones instead of 5. As you can see, evet though both intervals have the same width in terms of chromatic semitones, they are named differently.
There are also "doubly diminished" and "doubly augmented" intervals but they are rare. For example the F-B# interval would be called a doubly augmented fourth, which is different than the F-C interval which is perfect fifth. Even though B# and C are enharmonically equivalent and both intervals have the same width in terms of semitones, they are not the same. Check here if you don't know the difference between B# and C.
One possible source of confusion is that the interval quality is often omitted when talking about perfect intervals. So when someone says a "fifth", they usually mean a "perfect fifth".
For seconds, thirds, sixths, and sevenths, there are no "perfect" intervals. They can be either minor or major (or diminished, augmented, doubly diminished, doubly augmented etc.). Minor intervals are 1, 3, 8, and 10 semitones wide respectively while the major intervals are 2, 4, 8, and 11 semitones wide. If it's smaller, it is diminished, if it's larger, it is augmented. So, the F-Ab interval is a minor third because it involves three scale degrees and it's 3 semitones wide. On the other hand, the F-G# interval is an augmented second because it involves two scale degrees and it's 3 semitones wide, one wider than a major second.
Here's a quick list of intervals with their widths in semitones:
Diminished Minor Perfect Major Augmented
Unison (first) -1(*) - 0 - 1
Second 0 1 - 2 3
Third 2 3 - 4 5
Fourth 4 - 5 - 6
Fifth 6 - 7 - 8
Sixth 7 8 - 9 10
Seventh 9 10 - 11 12
Octave (eighth) 11 - 12 - 13
(*) Some theorists reject the existence of diminished unison.