TNT cannons are powerful mechanisms that can be used to destroy both mobs and blocks from a distance, which may vary depending on how much TNT is used as a boost. They are often composed of redstone, TNT, water(bucket), a building material, and a power source such as a lever, button, or pressure plate.
A useful technique is to use redstone repeaters to time the priming of the ammunition TNT, making it possible to completely activate the cannon with the press of a button(or and other power source). You can adjust the repeaters to make the ammunition explode faster or slower(the slower it explodes, the farther distance it reaches).
Another technique is to use a slab block at the end of the cannon(underneath the ammunition) to get the best results in range, for a full block causes the ammunition to launch higher, but not as far, and no block causes the ammunition to launch farther, but not as high. A slab causes a equal range of hight and distance(providing the best range results as mention above).