Traders are only liable for funding payments in either direction if they have open positions at the pre-specified funding times. You are not liable for any funding if you do not have a position. If you close your position before the funding time, you will not pay or receive any funding.
Its not about you holding the contract for 8 hours, you must close it before the pre-specified funding times.
Also, remember due to the design of perpetual contracts and funding rates you can end up getting paid the funding rate