The concept of holiness is all about the existence of boundaries, and the enforcement of those boundaries. Leviticus is perhaps the book of the Bible which most clearly illustrates this. The Tabernacle set up, with its Most Holy and Holy Places, symbolises the fact that God is separate. The Priestly system reinforces this. At the same time, the Levitical legislation separates Israel as a people from those around them, and creates and enforces a number of boundaries within the people, between clean and unclean.
There appear to be three main boundaries: firstly the boundary between God and not-God, or the Divine and the created - this boundary is implicit in Leviticus, and brought to the fore in the Deuteronomic and prophetic denunciation of idolatry; secondly, the boundary between Righteous and unrighteous - this is really the same thing, but viewed from the perspective of fallen humanity, and therefore if you like ethically rather than ontologically; and thirdly, the boundary between the dedicated and the ordinary - this can be positive (a thing is positively set apart for God and therefore not for ordinary use) or very negative (as in the judgement on the peoples of Canaan, in which some peoples are found to be so corrupt that they are to be devoted wholly to the Lord by destruction rather than treated as 'ordinary' enemies of Israel and Israel's God). This third notion of holiness - instrumental holiness, if you like - runs through Old and New Testaments, but isn't what I'm talking about here. I have in mind the distinction between God and creature, and between Righteous and unrighteous.
When we say that God is Holy, we mean both that he is inherently the reality denoted by these boundaries - he is God and not creature, he is righteous and not unrighteous - and at the same time that he is the active enforcer of these boundaries - he will be God and not creature, he will be righteous and not unrighteous. Tied up with this latter is the idea that God will be seen to be God, and the Righteous One. He will vindicate himself by enforcing these boundaries.
That is why an encounter with God in his holiness is a terrifying thing. Think Isaiah before the altar. As the Seraphim sing out 'Holy, Holy, Holy', he can only respond with 'Woe is me! For I am lost!' The fear is not unjustified - to come before the Holy One in an unworthy manner is death. This fear is also the reaction to Jesus amongst those who understand who he is. The God who will be God over against his creature, and who will maintain and display his righteousness over against sinners - this Holy God, the God we encounter in Christ - he is to be feared. God's holiness seems to demand separation.
Throughout Isaiah's prophecy, God is 'the Holy One of Israel'. As the Holy One he is, God binds himself to unrighteous Israel. In just the same way, as the Holy One he is, God binds himself to his fallen creation. He will be Holy in our midst, not Holy without us.
Where is the logic?
In John 17, Jesus declares that he sanctifies himself - sets himself apart as Holy - so that his people might be sanctified. He enforces the boundary between God and creature, and between Righteous and unrighteous, by bringing them into the closest connection and yet being consistently God and consistently Righteous. I think it would be fair to say that at the cross he is the boundary. His existence is the Holiness of God, God in his active Holiness maintaining his right over against his rebellious creation.
It is just like Leviticus said it would be. Why build this tent to keep God apart from the sinful people? It was so that he could go with them! The boundary is enforced because without it God cannot be with his people. God maintains himself over against us so that he can confront us and relate to us.
God's Holiness in Christ should make us first fearful, and then thankful.