Filters work by drawing tank water through "a medium".
An external canister, has the media in the canister, and a pump pulls water from the tank throught the media and back into the tank. The bacteria which perform your biological filtraction live in the canister, (although there are always some in the tank coating the surfaces). Hang on back filters work in the same way.
Internal power filters use a pump to pull water through media, often sponges, held within the body of the filter. The bacteria live in the sponge. Sponge filters work in the same way, often air operated.
Undergravel filters use either powerheads, or airlifts to pull the tank water through the gravel. They use the gravel as media, and your bacteria are in the gravel.
So, they are filtering the tank water, using the gravel, (sand doesn't work with under gravel filters, it is too fine and falls between the plates and the bottom of the tank).
For many years, under gravel filters were the best available, (I'm going back 30-40 years here). Generally these days, ugf's are regarded as old fashioned, inefficient and problematical, there are, however, people that use nothing else. I used ugf's throughout the '60's and '70's without real incident.
I don't use them anymore, as soon as I could afford to use Eheims, I did. I keep planted tanks on sand substrates so ugf's are completely unsuitable. Even with gravel, the water movement through the gravel is not a natural environment for plant roots, and they don't grow as well.
If you have fish that dig, or move the gravel about, the filter will be badly affected, so not a good idea.