Of course they work. Fuels have historically been taxed quite highly in some countries. EVs are doing well in those countries and these countries tend to be a bit ahead of the curve in terms of adoption. Financial incentives help so they are a useful tool.
One caveat here is that governments also hand out subsidies and a much more effective way to penalize carbon emissions is simply to stop subsidizing it and then add the carbon tax on top. Yes, EVs get subsidized too. But it's peanuts to the many billions the oil and gas companies still continue to get their hands on to perpetuate the problem.
Whenever you hear oil companies defend blue hydrogen what they are really talking about is getting payed (with tax money) for the process of pumping insane amounts of natural gas for the next few decades so they can use that to produce hydrogen. That's "the hydrogen economy": pumping yet more gas to speed up how quickly our planet heats up. They'll emphasize how important that is and how green it is (or could be). Never mind that it is completely unprofitable to capture carbon at scale and of course tax payers are going pay for them pretending that it's going to be meaningful amounts. That's the game right now in terms of handouts. We're talking tens of billions being allocated for this madness.
Companies often double dip even and get also get subsidies for cleaning up their act (or pretending to) while also taking full advantage of governments wielding their power on their behalf, public spending on their infrastructure (e.g. pipelines), leniency when it comes to environmental issues, permits, and public money generally being used to clean up their mess.
A carbon tax would go towards balancing that; but only a little bit. Eliminating subsidies for carbon producers would cost the worst offenders the hardest and actually level the playing field in terms of cost for the alternatives that they've been allowed to unfairly undercut in pricing.
The irony is that getting rid of the subsidies is somehow more controversial than carbon taxes. That's how messed up our world is. We're actively paying to destroy it quicker currently. Every time you pay your taxes.