I have both in various thicknesses. My two piece suits are freediving-type suits with no inner line. Freediving suits particularly do not have zippers or other fasteners which keeps the cost and bulk down and reduces a source of leakage. I do not believe any one-piece freediving suits are made.
It is easier to get a good fit in a two piece because torso length does not need to be as exact. This is particularly important in thicker suits. Some people are harder to fit than others which may guide the choice.
One-piece suits with a liner are easier to get on (especially) and off (to a lesser extent) on a boat, fewer pieces to keep track of, no need to wet the suit and the skin before donning.
With some vendors, the two pieces of a two piece suit can be purchased separately, and therefore can be different sizes or you can purchase a replacement piece if you rip something and the other piece is still good.
With the freediving suits I use, water does enter the suit but it doesn't move through it much so the suits stay warm. Eventually they wear out and age out and lose their elasticity and then they leak more, so you replace them.
Like many things in diving, wetsuits are ultimately a consumable item that has to be replaced periodically. They're good for 100 dives or a few years, good ones maybe more.