Worfklows are a powerful tool to add events and states to your entities. Here's how to get the current state programmatically:

// Make sure the entity is an object
$entity->get('moderation_state')->getString();