Late-time acceleration due to a generic modification of gravity and the Hubble tension