When two parts form a harmonic interval of a perfect 5th, this should not normally be followed by another perfect 5th between the same two parts, in Classical harmony. This is called consecutive 5ths, (or parallel 5ths).
Here for example, the first beat of the bar creates a harmonic interval of a perfect 5th with the notes C and G. This then moves to another perfect 5th, D and A. This should be avoided.
The same is true of consecutive perfect octaves.
There is no problem, however, if the same notes are repeated:
And there is no problem if a perfect 5th moves to a diminished 5th (but the diminished 5th must then resolve correctly):
Diminished 5ths may not move to perfect 5ths however, because the diminished interval is unable to resolve correctly:
Avoiding consecutive 5ths and octaves is essential when you are writing harmony in the Baroque, Classical or Early Romantic style. It is one of the most important rules to obey.
However, it’s also important to realise that consecutive 5ths and octaves were used widely in the earlier Medieval style, and also in the later 20th and 21st century styles, and they are widely used in pop, folk and jazz.