There's four things to check:
Firstly, the profile (extrusion) of the case must be the same, so look at the width and depth dimensions. Everybody measures it differently, but as long as it's close, it'll be ok.
Secondly, the length. You can use any length you want, but you have to understand that a very long one will mean that you might have to raise the seat. When you know the length of the new battery, you can check where the top will be relative to the seat. Also, the lock-pin goes into a hole in an aluminium strip, so if you get a longer battery, you need the aluminium strip that goes with it. Make sure that the supplier provides that.
Thirdly. the contacts can be the wrong way round. Always check with a meter before connecting. Sometimes there's minor differences in the pins, which might need a bit of adjustment/filing.
lastly, the charge socket. No problem if they provide a matching charger, but some use the coax socket. Also, you shoud check the polarity of the charge socket before using you existing charger.
In most cases, everything will be OK, but it's always best to check.
The number of amp-hours doesn't matter. The more you have, the further you'll go.
Some vendors supply the battery as a complete kit with the aluminium strip and the matching base-plate, like this one:
https://www.aliexpress.com/item/Bottom-discharge-700W-Silver-fish-24V-22AH-lithium-battery-24V-ebike-bike-battery-Use-3-7V/32689403787.html?spm=2114.40010308.4.12.qWAYXS