If you say the sun is 'vlakbij', I'm pretty sure that's relatively vlabij :-)
The only difference I can think of is that I would use 'dichtbij' more often for persons and or other things that can move and 'vlakbij' more often for places and or other things that don't move. I don't think one of them is closer.
I wouldn't say that that's a rule though. Maybe other Dutch people will disagree.

If you use "ligt" for a person, it means that person is lying down. So the sentence would be "He is lying nearby". You can use "ligt" as in "is" or "is located" for things or places that are either in a lying position or are metaphorically lying on the ground (like a country, for example : Frankrijk ligt dichtbij).

Litterally, it would mean "He is standing nearby". When it comes to a person, if you don't know in what position they are, you can simply use "is". But if you specify "staan", "zitten", or "liggen", it means you know for sure it what position he was.

So it's different for a person than it is for an inanimate object. For example, if I said "Frankrijk ligt dichtbij", it means "France is close", not "France is lying close".