You have to visualize the scale or arpeggio you are working on as extending infinitely through octaves both above and below where you currently are. The visual pattern on the fingerboard is the same.
So on a standard-tuned 4-string, in D major, that F# at the 2nd fret, E string, is still the 3rd of your chord. It’s relationship to the D at 5th fret, A string, is exactly the same as the relationship between F# at 4th fret, D string and the D at 7th fret, G string, albeit one octave lower.
Just as you noted that the open A, or A at 5th fret, E string, is the 5th of D major just as much as the A at the 7th fret, D string is. (aka 2nd fret, G string; 12th fret A string; or 17th fret E string - those are all the same A note).
Another way to visualize it is to explore the D major scale starting at the 7th fret, G string, descending, then transpose that pattern one octave down.
So on a standard-tuned 4-string, in D major, that F# at the 2nd fret, E string, is still the 3rd of your chord. It’s relationship to the D at 5th fret, A string, is exactly the same as the relationship between F# at 4th fret, D string and the D at 7th fret, G string, albeit one octave lower.
Just as you noted that the open A, or A at 5th fret, E string, is the 5th of D major just as much as the A at the 7th fret, D string is. (aka 2nd fret, G string; 12th fret A string; or 17th fret E string - those are all the same A note).
Another way to visualize it is to explore the D major scale starting at the 7th fret, G string, descending, then transpose that pattern one octave down.