Dapps have to pay the blockchain platform they call.
There is a small amount a platform like Ethereum allows for free, like for ex. checking balance.
If a Dapp calls a smart contract the more elaborate the code the more (gas) fee the platform collects.
If a Dapp runs out of gas/tokens while the call is in processing, the call is canceled and any work done is reversed.