It gets complex.....remember we are talking about a boat shaped object. Most above are talking about transverse stability, but remember longitudinal stability is also an issue.
Transverse stability is dependent on a number of factors. The displacement(V), the center of buoyancy (all underwater volume)(B), the vertical center of gravity (the vessel, her crew, fuel, water, etc)(G), and the waterplane area and distribution (Iw). There's another point involved called the metacenter (M), it's mythical (an invention) and it's the point around which the boat is said to rotate when heeling.
The distance between G and M is called GM, and it's length (in feet or metres) is another basic measure of stability.
When a hull is floating level and upright the center of buoyancy (B) is on the centerline somewhere below the waterline. Not far below if the hull is a shallow barge, a long way below if its a deep and narrow type. G is (hopefully) also on centerline somewhere above B. In modern powerboats it's well above the waterline, in ballasted sailboats it's close to or slightly below the waterline. M must be above G for the hull to be positively stable.
As the hull heels B moves to the low side and the area of the waterplane changes shape (depending on hull form). In a flat shallow barge B moves quickly while in a narrow and deep hull B moves slowly. If you visualize B as an upward force and G as the downward force you see that as long as G stays on the centerline and B moves to one side there is a righting force created between the two.....Forcing them back into line(upright).
The distance (in feet or metres) between those opposing forces is called the righting arm (RA or GZ). The RA multiplied by V (displacement) is called the RM, righting moment. Most stability curves are of RA values.
You can increase stability by lowering G or raising M. Lower G by adding ballast on the keel or removing weights up high (dinghy on the roof, etc). Raise M by changing the shape of the waterplane or the displacement.
So adding length might change the waterplane if new volume is greater than the structural weight added (boat floats higher). The added displacement will increase RM, righting moment, because that's our RA multiplied by displacement. But unless we make the boat wider RA will not change. So it will take more force to heel the boat, but she will capsize at the same heel angle as the shorter boat........