Your maximum power is already given by the driver.
Assuming that 24V motors are easier to come by, $$24V * 43A = 1023 W$$ electrical power. I am assuming that you have the combined maximum output at $43A$.
Depending on what type of motor you find with $24V$ Voltage and $1kW$ power you can add a gearbox and adjust wheel diameters to get to a desired performance.
A $150mm$ wheel diameter gives you $150 mm \times \pi = 471 mm$ of travel for one rotation of the wheel. The target $5 km/h$ equals to $83 m$ each minute. If you advance $0.47 m$ at each wheel rotation, this $83m$ each minute results in a requirement of $176 rpm$ rotations per minute on the wheel. Using a different unit of measurement for the rotational velocity, this gives you $18.43 rad/s$. Basically, you need to find a $24V$ $1kW$ motor and gearbox that will result in an output rpm of $176 rpm$. Please note that this is at the wheel axis, so any differential transmission will also have a reduction ratio which needs to be considered.
We know the maximum electrical power and let us assume an $80\%$ efficiency (conversion rate to mechanical power). That gives you about $800W$ of mechanical power. Now we know that your target velocity is $18.43 rad/s$ and we know that:
$$ P = \tau \times \omega$$
Mechanical power is the product of torque and angular velocity. We can calculate that for the given mechanical power of $800W$, with the target velocity of $18.45 rpm$ you will have $43.4 Nm$ of Torque available at the wheel axis. Now we have assumed $150mm$ wheel diameter, so the radius of the wheel is $75mm$. $43.4 Nm$ on a distance of $75mm$ produces $578.6 N$ of force. This is the maximum force that you can get at your wheels.
$40\%$ slope translates to $21.8 \deg$. From this we can deduce, that the sin component of your gravitational force cannot exceed $578 N$. At the limit
$$F= m * g * sin(21.8 \deg)$$
$ 578.6 N = m kg \times 9.81 m/s^2 \times 0.189$. So your absolute maximum weight from a static perspective is about $312 kg$.
Please note that this is the max weight you can move at $5km/h$ with a $1kW$ motor at a 40% slope on a perfectly flat terrain and it does not mean that with this weight your system can actually accelerate to this velocity. The more you are under this weight limit the more dynamic performance your system will have! Furthermore there might be some fictions forces to consider from the 140 cc engine that will further reduce the dynamic performance.
For the power capacity, if you put the two batteries in series, you get 24V and 18 Ah. This will mean that your batteries will be able to power your system under full load, for $18Ah / 43A = 0.41h$. So about 24 minutes of fun.