More context is needed to see what exactly you are trying to say, If you are referring to hitting by car, the second sentence means that you came intentionally close to him to hit him, but the first sentence means you are glad that you didn't hit him despite being very close to him. So they could be totally different. You can get better help if you provide more context.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
voynichcame close to hitting himTo my ear, this sounds a bit more emotionally charged than "almost".