Did John the Baptist and Jesus know each other as close relatives?
To what extent John the Baptist and Jesus knew each other is an open question. While Mary and Elizabeth clearly knew each other (Luke 1:39), the Gospel does not give us any indication as to how close they were and whether their children would have spent much time together growing up.
There are numerous reasons why Jesus and John the Baptist might not have spent much time together. Perhaps Mary and Elizabeth were not very close and did not spend time together outside of family gatherings. Perhaps Elizabeth and Zechariah died when John the Baptist was very young and he was sent to live with relatives who lived farther away, and Mary was even less connected with them. Perhaps after Herod's massacre both families decided it was best to stay apart from each other.
In the Gospel of John, John the Baptist explicitly denies knowing Jesus except by the inspiration of the Holy Spirit (John 1:31-32).
On the other hand, in the Gospel of Matthew, John instantly upon seeing Jesus proclaimed himself unworthy to baptize Jesus (Matt. 3:14).
Its also entirely possible that while John knew who Jesus was and that Jesus had a special mission from God, he did not know fully understand the implications of it all until the Holy Spirit descended upon Jesus like a dove.