Here's some stuff that helps with capturing cargo ships:
Many of these things can double as design goals.
Use a small ship with tightly grouped weapons, or fire your weapons individually. Try to hit only the turrets. You don't have to destroy all of the turrets, only the ones that can hit you. Land on the cargo ship, and hack stuffs. Fly the cargo ship home, with the small ship attached. You will need to be good at minimizing collateral damage, and/or jury-rigging systems by grinding other systems.
If you want to fight with a Large ship, for some reason, take someone else with you in order to control a single turret. Turn off any other turrets unless you lose the active one, and need to switch. That should mitigate collateral damage. This will be difficult against military ships because of their missiles.
You could also use a large ship that carries a small drone. Match speeds while you are still out of targeting range, and then use the drone to fight the turrets. Land it back on the main ship afterward. Grab the cargo ship with landing gear. It's easier if you can see where the landing gear is while you are maneuvering. Put your landing gear in a group, and put Auto On/Off and Release for the group in your hot-bar. You'll need good engine and gyro power for pushing or towing the cargo ship. See the "Steering trick" for methods of protecting your landing gear and tools without complex mechanisms, or awkward placement.
Steering trick:
You can put more than one control block on a ship. They don't have to all face the same direction. "Forward" will be relative to the one that you are using. This can help you with things like landing, grabbing, and docking. It also lets you do things like put several welders on one end, and several grinders on the other, and still be able to use them effectively.
If you left any turrets intact, shut off the generators before you hack them. If you just leave them, they might shoot your stuff when you drag the ship home. Turrets on solar ships will still work without generator power.
About turret targeting: Turrets lock on to systems when they attack a ship. If you put decoys on your ship, don't put them right next to stuff that you want to protect, and make sure that they also get into lock-on range before other components. The targeting system seems to prefer exposed components to armored components, as well as near ones to far ones. You still probably want to armor your decoys, if you use them. It's better to lose a decoy and some armor than any other block type. They are easy to destroy, but also easy to replace.
Have a recovery vehicle prepared, just in case you die or your ship loses mobility and cannot be repaired on the spot. Ideally, it should be able to grab and stop a ship that is spinning out of control.