The second part of your suggestion is more like the right answer. Sampling goes back to the days when we had hardware samplers. They have a blank memory so to speak and you either load sounds from either a hard drive or CD ROM into a samplers memory. Then you have a preset to play.
Sampling is also about doing your own samples. Samplers in the old days could be armed and audio was fed into them. Either the audio itself triggered the sampler into record or you manually put it into record.
Once a sound was captured various things had to be done to it. Dead air removed before the sound ie in front of the sound for a start. Sustained sounds could be looped or seamlessly joined. Some samplers allowed digital processing to be done such as changing gain, applying certain effects etc.
Then this sound is given a transposition range. One sample can be played a long way down and up in terms of notes. Or lots of samples are taken only small musical intervals apart and those then don't have to be transposed as far for a more natural sound.
Once all that work was done you ended up with a preset that you could also play. Filters and envelopes were applied as well as expression and effects. A sampler can do an enormous amount. The ultimate sounding machines are things like Emulators and Kurzweils.
Many sampling options are now provided in virtual form or are a part of the DAW program itself. Parts of songs and things can be sampled and just small bits like you mentioned can be used. Be careful so that these parts are not recognisable as you may run into copyright problems. But samplers are also good at taking well known things and making them unrecognisable as well. They are good at manipulating sound too.