Your iPhone 8 is still covered under warranty, you should go to the nearest Apple Store or contact Apple support to have them diagnose the battery. Make sure to do a backup before going in store because if they have to replace the device, they will not backup the data for you.