You do not have to upgrade from .NET 4 to .NET 8. If you have a "legacy" NET 4 function app then it must remain on NET 4. That is supported by the current v4.x app hosts. You can read about it here. Note that the EOL is not given and NET 4.8 is considered supported until the last version of Windows that uses it goes away. That is a while down the road.
Going forward however you should be using NET 8 for newer function apps and you should upgrade your function apps to the NET 8 runtime when you can. If you're using older NET 6/7 versions then you need to upgrade to NET 8 by end of year (see link). Upgrading from NET 6+ to NET 8 is minimal. Upgrading from NET 4.x to NET 8 will be a bigger undertaking.