Calculate lifespan of BLE ESP-32 module
But how is it done when the current is not constant but changes
between 'two current states' i.e. 150mA for 2secs then 10mA for 15secs
and then loops again?

The average current taken is: -
$$ 10 \text{ mA} + \dfrac{140 \text{ mA} \times 2\text{ seconds}}{2\text{ seconds}+15\text{ seconds}} = 26.5 \text{ mA}$$
That should be the current used.

Please note I know how to calculate the lifespan of the battery it is
just the current pulled by the device divided by the capacity of the
battery.

That assumes a fully charged battery discharged to a voltage level that may be below the minimum operating voltage for the blue tooth module so, you need to be aware of this and make plans accordingly. Maybe use a buck-boost converter to extract the maximum range. You should also consider that charging a lithium battery to its full level repeatedly may not give the best lifetime for said battery.