If you want to use a single Property to track both, you could create two different Views and apply a single predefined filter to each View, to only include traffic to the applicable hostname.
eg View for abc.example
Filter type - Predefined
Include Only traffic to the hostname that are equal to
rinse and repeat for the 2nd View, using the applicable hostname for that view (xyz.example)
If you were to want to use different Properties for each, you would need to add a tracking code snippet configured for a multitracker setup
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
window.dataLayer = window.dataLayer || ;
gtag('js', new Date());
and then create the above-mentioned filter for the Views in each Property, so as to restrict the data going to each Property's Views to only include data for the hostname applicable to the specific Property.