Proteins take longer for your body to digest than carbohydrates. Therefore an energy bar with a high level of protein is best suited as a post-ride recovery snack, when that protein can be used to repair your muscles or to be eaten at the very end of a ride - giving your body a headstart on muscle repair.
An energy bar that has a moderate amount of protein, say 5-10 grams, is also a good option for endurance rides such as long bikepacking trips and audax events.