If the vent plugs up you’re now having carbon monoxide inside your house, it uses a flame to heat, so more potential for fire. If something goes wrong you can have a gas leak. Electric is install it and forget about it, gas you have to watch it. That being said, I prefer gas, it’s more efficient, just have a carbon monoxide detector in the room with the dryer and clean your vents regularly.
To be fair: Electric dryers are still very much a fire hazard, if they’re not properly maintained. But a much smaller one.
I suppose the flame is a fair concern, but it’s pretty well protected. I had to open up my Maytag to replace the solenoids a little while ago and I was satisfied with the safety of the design. The burner valves fail closed and don’t open unless safe conditions are met.