Which is correct: "drive safe" or "drive safely"?
"Drive safely" is the formally correct phrase.
Saying "drive safe" sounds casual and informal; however, many people do it. This is because, in general, people sometimes use the adjective form as an adverb (usually this means not adding -ly) in casual speech. It is not recommended in any formal situations.
"Do good" is a different kind of issue, because the form depends on the meaning you want to convey.
If "do good" means "do the right/good thing", then "do good" is the formally correct phrase.
If "do good" means "perform correctly/at a high level", then "do well" is the formally correct phrase. (But, as mentioned above, casually you could also say "do good" here.)
I happened across this interesting article at The Economist, of all places, which speaks of this exact phenomenon, and notes that adverbs in adjective form have been around in English forever.
That article notes that there may be a subtle difference in meaning between "safe" and "safely," and I tend to agree. "Drive safely" more specifically refers to driving in a safe manner. "Drive safe" emphasizes the end result, being unharmed when you stop driving.
I'm often critical of poor grammatical constructions, but in this case, I think this is an acceptable phrase and does have a slightly different meaning or tone than "drive safely."
"Do good" has the unspoken meaning "Do good (things)" and generally refers to acting in a benevolent manner. If you mean to complete a task or test acceptably, you should say "Do well."
It is an old bugaboo of the grammar police that in any pairing of an adjective with its -ly-suffixed adverb -- safe, safely; slow, slowly -- the (nominal) adjective must never be used as an adverb. You may ignore this prescription.
As the OED quaintly puts the case for "safe": "Chiefly (now only) with quasi-advb force with verbs of coming, going, bringing, etc.," recording examples back to Chaucer as well as this more modern one from 1902:
Your ... man has brought us out ... safe and dry.