In reference to Exodus 19:17-20:21:
There are several reasons why the Israelites don’t want to be close to God. Yahweh’s behavior in this passage is intimidating, with all the lightning, thunder, smoke and explosions (reminiscent of the enchanter Tim in The Holy Grail). Who would want to get close to all that fire and noise?
Yahweh does distance himself here from his people, but he does it for a purpose. He has just delivered them from Egyptian bondage, and lest they think he will protect them no matter how they behave, he wants them to revere him, particularly as he delivers the Ten Commandments (Ex 20:1-17). They need to understand that he is holy, powerful, and concerned about obedience.
But in this incident, even as Yahweh is loud and frightful, he is also near and tangible. At the beginning of the passage, Moses brings the people out of their camp for the purpose of meeting God. God doesn’t allow them to come close, but there’s a good reason for that: he’s trying to protect them from harm.