Difference between "as" and "like"
You should use the word "like" when you mean that one thing is similar to another. "He is very much like my friend" While As is used to describe the function of a person or object. An example is "He works as a programmer".
In some cases as can be used as a conjunction and has to be followed by clause or a prepositional phrase, as is your example sentence. If you remove the word "did" and end with "as John" the sentence makes little sense.
In a very informal setting like can also be used as a conjunction, very often used in American English.
There is also the complication that arises with the context. In your sentence "as John did" may signify that nobody helped the elderly, because John already did. When you use like this complication simply does not arise.
So overall, I believe both are correct, although speaking strictly grammatically like probably shouldn't be used as a conjunction, but meaning-wise like clears up ambiguity, but creates a whole lot of other meanings. For instance it can imply that all the students were helping the elderly and nobody did it quite the same way as John.
So to sum up, both are correct and you should chose which one to use based on the context, and whether what you are writing is formal or no.