It's often used when you want to say that a certain action or decision is the last thing left after you've tried every option. with no reasonable or anticipated alternatives.
When you want to tell yourself what to do or what to do, you usually use it, and this is just the last thing you have tried. There are no appropriate or expected alternatives.
Usually used to indicate that doing something or making a decision is only the last thing left after all methods have been tried, and there is no other reasonable or expected choice.