Psalm 31:19 says:
Oh, how abundant is your goodness,
which you have stored up for those who fear you
and worked for those who take refuge in you,
in the sight of the children of mankind!ESV
You will notice the bold parts. Fearing God is used interchangeably (or at least closely related) with taking refuge in God. When the Bible refers to fearing God, it means doing things in such a way that you are chiefly concerned with pleasing/respecting/honoring God. We don’t fear Him as a malevolent being. We fear Him as the all-powerful being who is simultaneously very good!
Thus, our fear of God does not drive us away from Him. Rather, it drives us toward Him in a way that pleases Him. And in doing this, we are brought right into the refuge of His strong arms. Fear of God is the ultimate refuge.