The bullet passed by my head by a difference of a few inches.
I am trying to say that somebody fire a bullet at you that barely missed your head? Or Somebody fire a bullet that nearly hit me in the head. But it missed my head by a few inches. Would it be correct to say sentence above, to describe the situation?