Most of the time the bass or deep, bass-like sounds/voices are used as the basis for the sound of a piece. They provide the tonal foundation that the rest of the voices refer to. As a part of the rhythm section, it contributes to the rhythmic pulse of the piece. But the bass can do more than that.
For example: If you’re stuck for a connecting section or want to mix up your arrangements with something different, consider using the bass as a melodic instrument.
Depending on which bass sound you are using, you can add some sparkle on top and make the melody more easily discernible by combining the bass with a high-register instrument.
I have found that doubling the bass melody with instruments like flute or glockenspiel makes for a pretty and interesting sound.
Some examples
Even without using the bass as the main melodic instrument, it can also be used as a more equal part of the “ensemble”, as bass players like Paul McCartney, Phil Lesh or Chris Squire among others have shown. But that is a topic for maybe another time.