In this context, of indicates that you are talking about a small number of items from a larger group, in the same way as you would talk about
The best of Rihanna - (title of Rihanna's greatest hits album)
Rihanna has recorded a large number of songs: this album contains some songs from that group.
Looking at your sentences:
Take a few of the sandwiches
You could use this if there is a particular group of sandwiches available, and you are inviting the person to take some of them. You could not use it when suggesting that somebody picks up some sandwiches from a shop on the way to where they are going.
Take a few sandwiches
Here, there is no indication that there is a certain number of sandwiches available. You could still be talking implicitly about a particular group of sandwiches, so you could use it both situations.