How to change transform.position.x after a state is changed?

When I press attack button, player will change to Normal Attack state to perform Normal Attack animation and you will notice the player seem like step back a little bit as the width of sprite for Normal Attack animation is longer than Idle animation.

To solve this issue. I need to change the transform.position.x =+ 0.5 to move a bit further to match the position of Idle animation stands and transform.position.x =- 0.5 when Normal Attack state done its animation and back to Idle state. How can I perform transform.position.x =- 0.5 when when Normal Attack state done its animation and back to Idle state?

animation events maybe? https://docs.unity3d.com/Documentation/Components/animeditor-AnimationEvents.html

or you can use yield waitForSecond similar to: Finish Animation before continuing script - Questions & Answers - Unity Discussions