A funding rate is a periodic payment between longs and shorts that keeps the perpetual futures price close to the index price.
A perpetual has no expiry, so it cannot converge to spot by settling on a date. Funding is the substitute. The exchange looks at the gap between the perp and the index, publishes a rate for the next interval, and transfers that payment from one side of the market to the other. Traders pay traders. The exchange is the clerk, not the recipient of the funding payment itself. Trading fees are a separate charge.
What perpetual futures are defines the contract. The glossary defines funding rate and index price. Exchanges commonly publish the rate in the contract panel. The exact inputs differ. Check the exchange's docs.