How to collect the cycles from the useless canisters?

I would suggest not destroying the canister but reusing it to deploy whatever new wasm you’re deploying. That way the 1T cycles used when creating a new canister is not wasted.

Simply use the same identity and the existing canister ID in your new project’s canister_ids.json when deploying.