A lot of game masters when running games use combat encounters as filler between giving you story. I have played a lot of games where an encounter was used just to change the pace of the game and give the players something to do to pass the time. It can feel like being railroaded sometimes when this is the case too.
Most encounters should have a meaning or purpose. Do this to make the story feel like it is progressing or that the world is actually alive. When using it to make the story advance make the outcome of the combat being integral in the story. Maybe winning the battle and letting someone live comes back to effect things in either a positive or negative way. Negatives might be that the villain gets away and warns his allies. Maybe the villain gets away and knows the players next move. Positives might be that the villain gives the players information that helps them down the line. Maybe the villain can warn the players of some of the surrounding area.
Use encounters to increase suspense with the players. A combat encounter can slow the players down in a time sensitive quest. In order for this to work though you will have to let your players fail every once in awhile if they aren't taking the timeline seriously. The next time there is a time sensitive issue the suspense will be raised when they get into a combat encounter especially if they have to choose to take a short or long rest after taking significant damage. Sometimes it is best if a combat encounter is set up for the players to find a way to avoid it.
Reward players for their actions. It is common to hear from people say there should be consequences for their actions but reward them sometimes. If the players do something really well in combat reward them for the long haul. No, I don't mean to give them magic items but maybe you give them bows and arrows because in the local area there are a lot of enemies or monsters where ranged weapons are extremely useful. If the players avoid combat maybe you give them that information somehow. Information can be used as a reward in many instances. Information could be overhearing locals or enemies talk about something that will end up helping the players.
One really cool thing to do is have a witness to the combat so the legends of these characters can be spread. This will be really cool for your players because the story can be exaggerated and grow in scope to levels that increase expectations. When the players go to a city and one of the NPCs recognizes them by these legends it could be a really fun social interaction. This makes those combats very memorable.
These are just some tips. If you have some more or maybe some examples of some encounters that were used as filler feel free to mention it below. I love reading your feedback.