Both する and やる mean "to do." So, when do you use する versus やる and what's the difference
Very little, but when in doubt, use する.
They are interchangeable in many cases. For example, these both mean "Let's play baseball together."
一緒に野球をしましょう。
一緒に野球をやりましょう。

Thanks, you might be saying, but that doesn't answer the question. You are right and the truth is, there isn't a good answer. However, there are a few guidelines.

する
- する is more common. When in doubt, just use する.
- Used as the general way to make nouns into verbs [although in many cases, やる works too]
- 掃除をする (to clean)
- スキーをする (to ski)
- 仕事をする (to do work)
- する doesn't require a を but you can use it. やる requires を except in very casual conversations.
- 掃除する (to clean)
- スキーする (to ski)
- 仕事する (to do work)
やる
- Often (but not always) interchangeable with する with action words--things you physically do--often use やる
- テニスをやる (to play/do tennis)
- 宿題をやる (to do homework)
- But even though the following is something you physically do, this sounds weird to most Japanese x旅行をやる (to go on a trip - use する instead)
- Requires を (except in casual conversation)
- When meaning "to give," やる is used instead of する
- 餌をやる to feed (the pet) but not X餌をする
- 一杯やる to drink with someone: 一杯やりましょうか? How about getting a drink? [する is not used with these examples since it means "to give" or because they are idiomatic with やる]
- There are a few hard-to-explain cases where やる just isn't interchangeable. For example:
- X合格をやりました (I passed the test - use する instead) and
- x旅行をやる (to go on a trip - use する instead)
- やる also has a few slangy meanings. It can mean "to kill" or it also can mean "to have sex."
- So, unlike する, やる has a more nuanced meaning to it. It also may have a rougher sound than する to Japanese ears.
In short, する is more likely to be interchangeable than やる, so use する. The one exception is when やる is used to mean "to give" as in 餌をやる (to give (a pet) food). In that case, する isn't used.