Once you've announced that you're casting a spell, players can't take actions until you've finished doing so. Notably, opponents can't try to remove cards from your graveyard to stop you from collecting evidence.

Artwork
Loading artwork…
Sample Collector
Murders at Karlov Manor · #175 · EN
Nonfoil—Foil—
Card rules
Whenever this creature attacks, you may collect evidence 3. When you do, put a +1/+1 counter on target creature you control. (To collect evidence 3, exile cards with total mana value 3 or greater from your graveyard.)
2/3
"Whatever broke out of here is *at least* half bear... and I'd say some lizard as well."
Uncommon · Illustrated by Borja Pindado
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Pioneer Legal
Standard Legal
Standard Brawl Legal
Timeless Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Future Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
PreDH Not Legal
Premodern Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
If you can't exile enough cards to meet or exceed the required mana value, you can't choose to collect evidence at all.
You don't choose a target for Sample Collector's ability at the time it triggers. Rather, a second "reflexive" ability triggers when you collect evidence 3 this way. You choose a target for that ability as it goes on the stack. Each player may respond to this triggered ability as normal.