Yandex Metrica identifies each visitor with its own identifier ClientID. This ID is set in both cookies and localStorage, and gets shared across subdomains by default. A visitor who came to abc.com and then to sub.abc.com would be identified with the same ClientID in case the same Metrica tag is implemented on both.
UserID is another identifier that can be passed along with ClientID to onboard offline data in the future. UserID is the customer identifier used in your backend platform (CRM, CDP, whatever). The purpose of using the UserID is to open a possibility of onboarding customer attributes and events (e.g. sales data) mapped to your internal ID rather than to ClientID that is usually not stored on the backend.
Although many other product and marketing analytics platforms support data merging via UserID, Yandex Metrica does not. For example, if a person signed in on a laptop and on a smartphone with the same UserID, the automatically assigned ClientIDs for these two devices (browsers) with their data will not be merged into a single profile. Yandex Metrica reporting UI will report two unique Users.