When any appliance is making a loud noise, it is never a good sign. If your washing machine is reaching its spin cycle and that is manifesting in it making loud banging noise, then it is likely that the machine is out of balance in some way. When this happens, the tub of the washer will begin to bang against the sides of the washer, creating the noise. As you suspect, this isn’t good for the washer overall and needs to be repaired
If the washer is not making this banging noise every load, but rather just sometimes, you should stop it when it does happen. It is likely that the clothes are simply unbalanced. You can redistribute the wet laundry so it is evenly distributed and start the spin cycle again.
However, if you have a front-load washer, this issue can’t happen. If the issue is happening every time in your top-load washer, it means something more serious is wrong. The most likely culprit is the suspension rods. These rods help to limit the amount of side to side and front to back movement that happens when a washer enters the spin cycle. As these rods age, they no longer work as intended and need to be replaced. Unfortunately, this is a very involved repair. It often will require to take your washer almost completely apart in order to replace the appropriate parts. As there are often multiple suspension rods, it is also usually best to replace all of them instead of just a single worn one.