Make sure that all frames in the running/dashing animations are the same size and the Origin image point is in the same position in all frames.
There is a common trick that helps to avoid issues like that:
Create an invisible rectangular sprite with Platform behavior. This will be your main "character" sprite, controlled by the player.
Remove Platform behavior from your sonic sprite and pin it to the invisible character sprite, like a "skin".
This way animations on the sonic sprite will not interfere with platform movements.