It’s vital to use tools correctly, by using the leverage rather than straining your back.
Also, slowly work your way to the big jobs rather than going straight in to dig a border at once. Rather than working repetitively, mix up the jobs so your body is moving in different ways to let your muscles recover.
Probably the most common source of chronic pain is back injuries, so ensure your back is straight and you take regular breaks. Lift with your knees and don’t be a hero – stay within your capabilities if you’re moving paving slabs or composts.