What's the best way to attack heroes/creeps in Dota 2?

If I understand your question correctly, you want to know if mooving between each attack is more efficient than just right clicking your target and waiting for your hero to finish the job ?

You first have to understand the concept of "animation cancelling". Animation cancelling consisit in manually stoping the animation of the attack of your hero in order to "attack faster".

Example : let's say you attack with crystal maiden, when she raises her arm to throw an attack, the projectile is fired right after the arm started mooving down. Once the projectile is fired, letting her finish the animation (the arm going down) is pointless. If you start mooving right after the projectile is fired, you will gain the time of the end of the animation and use it to moove toward your target thus not loosing sight of it. This concept applies for almost every hero in the game as there is always a small time you can gain between the moment where the damage is dealt and the moment the next attack begin. I've made a more elaborate post about it : Here

I'll answer depending on your target :

Creeps

  • Neutrals : It doesn't really matter but if you can animation cancel you will jungle slightly faster.
  • In lane : Usually you don't want to auto attack creeps in lane so the lane wont push toward your enemy tower. Pushing makes last hitting more dangerous because you have to get furhter from your tower in order to get last hits. But the same concept of animation cancel applies here too.

Heroes

I don't see any reason to just "right click and wait", I'll show you some common situations in which mooving between attack is more efficient :

  • If you are chasing and don't want to loose sight : When you just "right click" and the enemy hero goes for some reason in the fog of war (because of trees or going high ground where you have no vision), your hero will stop mooving thus making the chase a lot harder. In this situation it's better to follow the enemy hero by choosing manually your path then attack him when you are in range.
  • If the enemy is not running in a straight path, you can choose a better one to catch up with him. When you are trying to catch someone, always try to take the shorter path between you and the spot your enemy is trying to reach (If he's trying to exit your jungle, try to be at the exit he's aiming for before him or at least faster than him). This applies even if he has a slightly better movespeed than you.
  • If you want to orb walk (I described this concept in the post linked above).
  • If you want to dodge a skill/skillshot : just "right cliking" makes your hero deplacement very obvious thus giving the opportunity to the enemy team to land a skillshot (Pudge's Hook, Mirana's arrow etc.). Mooving between attack (if you have a better movespeed than your target) will allow you to stay in range between attack while being able to quickly change direction.

So my answer will be : it's more efficient to move between attacks in most situations, you just have to get used to doing it.