Yes, it works for "do you like apples?", but you cannot say that to ask them if they would like an apple. The correct way to ask that would be 이 사과를 원하세요? meaning " do you want this apple?"
or 사과 드실래요? meaning "do you want to eat this apple?"
Although 사과를 좋아해요? and 사과를 좋아하세요? are the same exact thing and are not wrong, it'd be better to say 사과 좋아해 (informal)? and 사과 좋아하세요 (formal)? when speaking. I know it doesn't make sense grammatically speaking since you're leaving out the 를 part, but that's how we speak in Korea. Quite difficult to learn all the different ways we speak unless you spend some time to live there unfortunately. But the way you said it is also right.