What are the pros and cons of mechanical vs electronic shutter?

I recently bought a new camera that has a choice between using a mechanical shutter or an electronic shutter. (A Panasonic FZ300 if it matters.) I tried taking a few pictures each way and I see no obvious difference. I presume if one or the other was unquestionably superior, they wouldn’t bother making it a choice but would just use the better one. (Well, maybe not. Like maybe a new technology is clearly better but there are stick-in-the-muds who want to do it the way they did it 50 years ago. 🙂 So what are the pros and cons? Are their circumstances where one is better but other circumstances the other is better? Which do you prefer and why?