する and やる as “to do” are practically the same and interchangeable.
- 私がしましょうか?=私がやりましょうか?-> Would you like me to do it?
- 一回してみよう=一回やってみよう -> Let’s give it a try
One exception is, [noun + する] are NEVER substituted with [noun + やる].
- 彼女は大学で法律を勉強している (❌勉強やっている) -> She is studying law at college
- 彼は毎日ピアノを練習する (❌練習やる) -> He practices playing the piano every day
- 彼女は毎日運動する (❌運動やる) -> She works out every day
However sometimes [noun + をする] can be substituted with [noun + をやる], especially in the continuous aspect [noun + をやっている]. The caveat is the emphasis is on “sometimes” and there is no clear-cut rule.
- 彼等はコンサートのための練習をやっている -> They are rehearsing for a concert
- 本当かどうか、実験をやってみよう -> Let’s do a test to see if that is true
- 彼は新製品の開発をやっている -> He is developing a new product
The below will be understood without any problem, but the native speakers will almost never use.
- ❌彼女は大学で法律の勉強をやっている (✔勉強をしている)
When it comes to jobs and business “をやっている” is used as often as ”をしている”.
- 彼女は弁護士をやっている -> She works as a lawyer
- 彼は飲み屋をやっている -> He runs a pub
When in doubt, you are better off using “をしている” over “をやっている”.
する cannot be combined with the aux verb of capability/possibility れる (because the result would be される and it will clash with the aux verb of causative される) , so “can do” will be either やれる or 出来る.
- それはやってやれないことはない -> That is not impossible to do if you really try
- やれるところまでやろう -> Let’s do as much as we can do
Finally, both する and やる have other meanings than “to do”, and they are not interchangeable in those usages.