Practical
Elizabeth and Zecharia were of the priestly Levitical tribe. They lived in the hill country of Judah, probably at Hebron.
Joseph and Mary were of the children of Israel in the tribe of Judah. After traveling and living in Egypt, they returned and lived in Galilee in the city Nazareth.
The two towns were about 100 miles apart. Walking at 10 miles/hour, that's a 10 hour trip. Pretty far for "get togethers".
Luke 1:39:40 In those days Mary got up and went hurriedly into the hill country, to a town of Judah, and entered Zechariah's house and greeted Elizabeth.
Luke 1:26 In the sixth month of Elizabeth's pregnancy, the angel Gabriel was sent by God to a town of Galilee called Nazareth,
The two cousins could have seen each other at Passover, Pentecost, and Tabernacles when all the males were required to come to Jerusalem. But this is not to say that wives and children necessarily would have come. As well, the priests would have been very busy at the times.
There was a certain sense and tension that the different tribes "kept to themselves". As an example, there was this time in the temple.
Mt. 21:15 And when the chief priests and scribes saw the wonderful things that he did, and the children [of Israel] crying in the temple, and saying, Hosanna to the Son of David; they were sore displeased,
Contextual
With all of that in mind, however, there is no particular reason the two weren't familiar with each as they grew up. The virgin birth, flight to Egypt, return to Nazareth all had led to a fairly normal life of day to day work and survive over the last 30 years.
In John 1, however, the context changes. We are now introduced to John's priestly ministry. He was baptizing apart from the Temple structure authority. Jesus didn't perform miracles before His calling either. He wouldn't have "shown off" to John that He was the way, truth, life. He too was just another man until about age 30, also in the ministry. So, when John says "I knew him not, but I come baptizing. In that way, when the Spirit descends and remains, then I will know him." He is referring to Jesus as the Messiah, not as a cousin, friend, or unknown citizen.
John knew about Messiah's preexistence, but up until the God-given sign for him to be identified (Spirit descend and remain), he had no reason, except apparently wild tales to believe the actual Son of God was now before him. Besides, it wasn't up to John per se to identify Messiah. It was up to God. John says, I don't know until the Spirit descends and stays on Messiah.