HTC said it will sell part of its unit for extended reality (XR) headsets and glasses to Google for $250 million.