I think Palpatine considers the lightsaber an inferior weapon. But it is also a good weapon to defend against other light sabers and to keep the extent of your powers hidden. Palpatine gets Anakin to act and then he has no need to hide because Anakin is his servant from that point on.
There is less an excuse for Yoda. Other than him being a teacher and former active Jedi. He probably used to use one on a regular basis. It made sense in ATOC, but his tactics, while cool to see from an action point of view, don’t exactly match his personality. I think they did that because he is supposed to be the best with a lightsaber and the character was CG. I think they could have done something that looked more effortless. The way they have Darth Vader fight in Rebels is more what I think they should have done. But, on the other hand, I can see where that tactic would have been appropriate when he was a young Jedi. We have seen that a Jedi’s tactics can change over time.