Dash towards cursor

I want to make something where, if the player
presses a button, they dash in the direction of the mouse, into the mouse and, of the mouse pointer is outside of a certain range, the player moves as far as the max range. I did a lot of research on this but all of the discussions are very incomplete.
Note: my game is a 2d top-down game with combat mechanics based of dota and league of legends

That is possible by getting the mouse position and translating it to worldspace. This link will explain you in detail how to do that:

At that point you will have the mouse position and then all you need to do is move the player to that position.