In general it can be said that both sport earplugs and sport headphones have the same functions, a condition is that they can withstand sweat. However, nothing is as irritating as earplugs or headphones that do not want to remain seated during exercise.
If you exercise outside often, it is better to opt for a headphone that lets through ambient noise such as the Aftershokz. It is a lot safer if you can continue to hear the traffic around you.