>> The point is to get people in those contries to overthrow their leadership.
>That's the theory, but has it ever worked?
The point is not to (directly) instigate regime change, but to influence the actions of the existing regime, as well as other state actors not under sanctions, by demonstrating to them how bad it can get. Make an example and so on.
The suffering of the civilians is not the goal of sanctions but a consequence of the choices their - legitimate or not - leaders make, and which ultimately impacts their ability to engage in foreign trade. No country has an obligation to trade with any other, so if civilians suffer after foreign trade is limited, the agency and moral responsibility is with the regime that failed to secure friendly trade relations. Often, humanitarian exceptions are carved out to limit this.
It definitely "works", in the sense that it's often the only tool available, along with positive reinforcements such as aid and support and the threat of stopping them, which is just another flavor of the same. It's hard to have a benchmark for something that "works" better, since countries are sovereign and by definition have disputes and don't blindly follow any established rules or rulers.