Cofactors are required to transform inactive apoenzymes (protein only, not currently serving any function in the biological system) into active, holoenzymes (proteins that actually do things). Despite the snark in the above writeup, the distinction between cofactors and substrates is actually rather clear. Cofactors are merely helpers in the process of attatching an enzyme to a substrate, they do not inherently do anything themselves.

A nice metaphor would be a magnetic key used in a hotel: the apoenzyme is just the plastic card with the magnetic strip; it has not been activated yet and sticking it in the card slot to your door won't do a thing. The cofactor is the machine behind the desk that encodes a magnetic pattern to open the door. The key still doesn't do anything yet, but the cofactor has allowed it the possibility. The final reaction is between the enzyme and the substrate, actually sticking the key into the door.

That said, cofactor is actually a broader term for several different classes of enzyme activators. They can be organized into a tree:

                          Cofactors
               _______________|_____________________
               |                                    |
        Essential Ion                           Coenzyme
    ___________|__________              ____________|___________   
    |                     |             |                       |
   activator ion metalloenzyme     cosubstrate     prosthetic group
   (loosely bonded)    (tightly bonded)          (loosely)             (tightly)