Check if service exists in Drupal 8

In Drupal 8, a service is any object managed by the services container. Drupal 8 introduces the concept of services to decouple reusable functionality and makes these services pluggable and replaceable by registering them with a service container. Services are used to perform operations like accessing the database or sending an e-mail.