There is no correct answer as to which chord you "should" play because you can use whichever chord you think sounds best in a given situation.
What you're describing is essentially changing the voicing or the way the chord sounds without changing the chord. There are many, many ways to play the same chord but each one has its own unique sound. Here are just a few different ways of playing the B major on guitar:
And that's not even close to all of them as you can omit notes, skip strings, you can play with a capo or use an alternate tuning on the guitar which provides even more options for different chord voicings, etc. and all of these things change the way the chord sounds and none of them are "wrong" or "correct", they are just different.
To give an analogy, asking which version of a B major chord to play is like asking what color of blue to paint the sky in your painting. In the same way, there is no correct or wrong answer and it's up to you to figure out what color blue you want your sky to be.
I'd say that the only exception here is if you are trying to learn a song written/played by someone else and you want to know the specific voicing of B major they used in their song so that you can sound exactly like the original when you play it. But when you are writing your own material, there is no right answer and it's simply a matter of which version of B major you like.
You should experiment with different versions of the same chord and train your ear to hear the subtle (or not so subtle) changes that they make. You might find that you like the 2nd fret B major for one song but like the 14th fret B major in a different song. Or maybe even just 3 strings instead of playing 5 or 6 strings. Etc.
Overall when learning music theory you should keep in mind that there is no "correct" way. Music theory is not a set of rules that you must follow and obey, it is simply a set of tools to help you create your own music and to better understand other people's music. You can choose to use these tools or not as you see fit. :)