Hola Pedro!
I think the main difference is that if the object is a thing, you are more likely to use 'prefer': 'I prefer the red shoes over the blue ones.' But if the object is an activity, you are more likely to use 'I'd rather': 'I'd rather stay at home tonight. You guys go ahead and go out.'
Note that you could also say "I prefer baseball over basketball", and "I'd rather wear long-sleeved shirts than short-sleeved ones". In the former sentence, the object is a thing (a game) and in the latter, the object is an activity (wearing a thing).
I had to think a lot about this. I'd welcome comments from other native speakers.
Ted