Given the Google Pixel 2 XL doesn't support Miracast, fortunately you can still use Google Cast as a wireless display option with the phone. A popular casting device that can be used to enable Google Cast is the inexpensive Google Chromecast (2013) which is able to display YouTube and other Apps from Android smartphones like the Google Pixel 2 XL on to Smart TV's using Wi-Fi.
Make sure that you have connected the Chromecast to one of the HDMI ports of the TV and powered on the Chromecast by attaching the USB cable to a TV USB port or a USB power adapter. You also need to make sure your TV is powered up, and the HDMI input of your TV is the same port that the Chromecast is connected to.
On the Google Pixel 2 XL, the Chromecast should appear as one of the Devices that you need to select ‘Set Up’. While the phone tries to link with Chromecast, the phone's Wi-Fi settings may also switch to join the Chromecast Wi-Fi network.
Once connected, you will see a code on the TV which you need to verify the correct Chromecast device is being used. It's good to also check that you have selected the same HDMI input on the TV to which your Chromecast device is connected.
Then go on to set up the location, name, and Wi-Fi network connection for Chromecast.
When completed wireless casting process, the phone's screen will be shown on the TV connected to Chromecast. You can now experience Chromecast enabled Apps like YouTube and games on your phone on a large TV screen just by selecting the Chromecast icon on the App menu bar.
It's quick and simple to set up the Google Chromecast (2013) from the Google Pixel 2 XL which also works well with a Samsung TV like the Samsung MU6300 4K UHD TV, enabling heavy YouTube users or movie enthusiasts to enjoy shows with friends.