Apple has started an iPhone 8 Logic Board Replacement Program for “a very small percentage of iPhone 8 devices” that has manufacturing defects. Affected iPhone 8 units may encounter unexpected restarts, frozen screen or won’t turn on. Apple sold those affected units between September 2017 and March 2018 in Australia, China, Hong Kong, India, Japan, Macau, New Zealand and US.
To see if your iPhone 8 is eligible for the replacement, enter the serial number at Apple support recall program website. You can find the serial number of your iPhone under Settings > General > About.
If your phone is one of those unfortunate ones, send it to your nearest Apple Retail Store or Apple Authorized Service Provider or Apple Repair Center to get it repaired.