Open Keyboard Viewer, see if F1 highlights itself when this happens.
Does yours qualify for Keyboard Service Program for MacBook, MacBook Air, and MacBook Pro...
https://support.apple.com/keyboard-service-program-for-mac-notebooks
Eligible Models
To identify your computer's model and to see if it is eligible for this program, choose Apple () menu > About This Mac. Eligible models are listed below.
- MacBook (Retina, 12-inch, Early 2015)
- MacBook (Retina, 12-inch, Early 2016)
- MacBook (Retina, 12-inch, 2017)
- MacBook Air (Retina, 13-inch, 2018)
- MacBook Pro (13-inch, 2016, Two Thunderbolt 3 Ports)
- MacBook Pro (13-inch, 2017, Two Thunderbolt 3 Ports)
- MacBook Pro (13-inch, 2016, Four Thunderbolt 3 Ports)
- MacBook Pro (13-inch, 2017, Four Thunderbolt 3 Ports)
- MacBook Pro (15-inch, 2016)
- MacBook Pro (15-inch, 2017)
- MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports)
- MacBook Pro (15-inch, 2018)
- MacBook Pro (13-inch, 2019, Four Thunderbolt 3 Ports)
- MacBook Pro (15-inch, 2019)
Note: No other Mac notebook models are part of this program.
https://www.apple.com/support/keyboard-service-program-for-mac-notebooks/