This is a very common instance of confusion, although in most cases the two are interchangeable. Only a real stickler (or very dedicated editor) would single these out as errors. In any case, it helps to know what these words’ proper uses are.
Again, if used interchangeably, either like or such as are correct when introducing either a list or comparison:
Darcy loves cookies like chocolate chip and peanut butter.
Darcy loves cookies such as chocolate chip and peanut butter.
Generally speaking, like suggests a comparison whereas such as suggests a list of examples. If using only one clause as comparison, it’s better to use like, as the sentence flows better (but that’s more a stylistic preference as opposed to a necessary correction).
Darcy makes cookies like chocolate chip and peanut butter. (Cookies compared to chocolate chip and peanut butter.)
Darcy can make all kinds of cookies, such as chocolate chip, peanut butter and oatmeal. (Chocolate chip, peanut butter and oatmeal listed.)
Darcy can make all kinds of cookies like chocolate chip. (Like used to list one item.)
A good way to remember when to use such as is when you would use including (unless you decide to use including instead).
Our bake sale featured a variety of cookies, including chocolate chip, peanut butter and oatmeal.