This may be a bit of an unusual recommendation, but I've found biological warfare to be the best solution for fungus gnats: Drosera capensis, Cape sundews, are like nature's bug vacuum.
There is a bit of time waiting for the plant to get ready to go, maybe a month to six weeks, but they require virtually no care aside from ensuring they're in a bath of water at all times, and they absolutely EVISCERATE gnat populations. I used to have a terrible problem with them until last year when I got my first D. capensis, and roughly counting, one plant in a month caught over 170 bugs. They're super fun to own and their colors are dazzling.
https://highlandmoss.com/wp-content/uploads/2022/03/IMG_3733-scaled.jpg