Building Routines
If you create a hazard that can't consistently attack the PCs (such as an electric fence, which only damages creatures touching the fence), it can be deadlier than normal in other ways.
The hazard should have as many actions as you feel it needs to perform its routine. If you split the routine out into several actions, you can also remove some of the hazard's actions once partial progress is made in disabling or destroying it; this can give the PCs a feeling of progress, and it can encourage them to handle the hazard if it appears in an encounter alongside creatures.