In PCBNew, the intention of the function Edit: Cleanup Tracks and Vias is to remove track segments which are not fully connected or overlap. Generally this is debris from changes made during layout.
There is also a pop-up window which provides options:
Delete Tracks Segments Connecting Different Nets
These would usually be considered a short between 2 nets. The layout function normally prohibits this but there are ways to create unintended shorts. The Bug checker will identify these shorts. This option should be enabled.
If you intentionally need to connect nets, use a “net-tie” in the schematic and associated link on the PCB.
Delete Redundant Vias
This has value for removing extra Vias. However, many times there are Vias used to connect top and bottom planes (zones). The zones MUST BE FILLED if you select this option. If not filled, the vias, which are in parallel and therefore redundant, will be deleted. Be careful with this option. It is possible to recover using Control-Z.
Merge Overlapping Segments
Sometimes if you drag a block, the tracks can overlap. This option will cleanup those overlaps. This option should be enabled.
Delete Dangling Tracks
These are segments to that are connected on only 1 end or just floating. This option should be enabled.