There are a lot of things you can do as a DM to mess with your party, but there are times this ends up being a terrible idea. A great one you can do to motivate your party is by stealing their shit. This can be a lot of fun, and at least one time it can be used to get your party to go exactly where you want them to go. But when robbing the party, there are a few things you want to keep your eye out for, though this can vary based on the game system you are playing. While the core idea can apply to other systems, my example will focus on Pathfinder 1E and 3rd edition and earlier Dungeons and Dragons.
When robbing your party, do not steal the wizard's Spellbook/Spell components. Yes, it seems like a fantastic balancing measure mechanically as the Wizard is incredibly powerful, the fact the source of their power is tied to an object rather than something innate sounds like it was put into the game as something for the player to take into consideration when making their character. The problem is if a Wizard loses that spellbook, the game practically becomes 'Well, I guess I just kind of sit here and wait for the party to sort out my problem'. While there are defiantly roleplay elements you can work with, so much of what a wizard does is tied to that spellbook that almost all options available to them are immediately stripped away.
They have virtually no more combat utility, their best stat isn't very good at skills that would help track down the thief's or convince people to help them out or give them info. Outside of some very contrived scenarios, their only course of action is to rely on everyone else to handle the task for them. This doesn't create interesting gameplay for the wizard, it just stops them from being able to play the game. It's something that can work great in a video game, where the party is controlled by one person, but in a tabletop RPG, you want to make sure all of your players can contribute. Now it's fine if a player just opts not to do anything, that's their choice, but when their key feature is stripped from them, and all of their class basically revolves around that thing, it's a different story.
A similar thing revolves around the Gunslinger from Pathfinder. Now, I don't like the way guns work, but where I ever to run a game with a gunslinger I would never take away the player's gun. It doesn't hit them as hard as the wizard, as they still have some basic combat options and a different skill loadout that will likely come in handy, but every unique class ability revolves around that gun. Take it away, even for a short period, you've turned the gunslinger into a shitty fighter/Rogue.
What this is can vary on the system, but it's never a good idea to strip a player of their core abilities for a prolonged period. In most scenarios it doesn't lead to interesting encounters or storytelling, it just leads to your players not being able to play their characters. This isn't to say you can never steal from your party, just that you may want to be a bit selective about what it is you are stealing. Make sure you are stealing enough important stuff that the characters are motivated (Honestly this isn't hard to accomplish. Steal 50PG from a party with 5,000GP will probably hunt the fucker down), so just be careful you aren't crippling your character's core abilities when you do so.