If you put a data pack, either .zip format or extracted to a folder, Minecraft will keep it in memory and won't allow deleting that world, either from game thru Singleplayer > Select the World > Delete or manually deleting from .minecraft/saves
This also accrues with resource packs and doesn't allow deleting them.
To fix the issue, you have to close the game or restart it.
When trying to delete a world in-game with this bug, the console log will say this:
20:06:39.281
Couldn't delete directory C:\Users\vanjm\AppData\Roaming\.minecraft\saves\datapack tester\datapacks\debug tools\data
20:06:39.281
Couldn't delete directory C:\Users\vanjm\AppData\Roaming\.minecraft\saves\datapack tester\datapacks\debug tools
20:06:39.282
Couldn't delete directory C:\Users\vanjm\AppData\Roaming\.minecraft\saves\datapack tester\datapacks
20:06:39.282
Unsuccessful in deleting contents.
21:37:34.084
⚠️ Please do not mark issues as private, unless your bug report is an exploit or contains information about your username or server.