This does create weirdness though.
Typical Star Wars space travel involves a ship leaving the planet's surface and getting a few thousand miles away from the planet to reduce the mass shadow of the planet while calculating a jump to hyperspace. Normally this takes 3-30 minutes depending on the speed of the ship and how much preparatory time it had to anticipate the jump. For large ships like bulk freighters this time is effectively reduced because they generally load and unload from a position a few hundred to a few thousand miles above the planet using smaller ships called barges to ferry loads back and forth from the planet, and then generally leaving on fixed schedules so they can precalculate the jump (often spending up to a day optimizing the jump while being loaded or unloaded).
What this means is effectively that space travel is quite rare and generally only occurs near planets in routinely travelled areas. So it's actually quite easy for a law enforcement agency to hang around in any place it needs to be, since the space it needs to patrol is a tiny tiny area compared to the vastness of space and if needed Star Wars ships can hustle around sublight space at say up to 4% of lightspeed.
So the problem you have is how do battles actually take place? In particular how does something that is a big part of the canon like piracy actually work? Smuggling is pretty easy to explain but piracy is hard because typically a ship with valuable cargo is never far from aid by legal authorities except on the most backward worlds which couldn't afford a local police force - and those worlds have scant traffic that itself doesn't carry valuable cargo. For most of the Star Wars universe, a would be pirate would have to hang around a hyperspace transfer point exactly where the authorities would be hanging out and would simply not be able to attack a ship, rob it, and get away in time to avoid being attacked themselves.
So a lot of the answer for me turns on "hyperspace jumps are very difficult" which is nothing that comes up in the canon. But my estimate is about 1 in 500 hyperspace jumps go bad and result in some form of problem where the ship then has to spend some amount of time travelling at sublight or else is stranded for some time needing to replot a new jump (often requiring hours) or rescue. And since galaxy wide there are millions to hundreds of millions of jumps daily, that's a lot of ships that in some level of distress every single day. And instead of a rescuer, you get a pirate who jumps in before the authorities can arrive and robs the stranded "motorists". This is one of the places my complex hyperspace failure rules come into things, as the PCs are themselves familiar with missing jumps and having to handle the problems that result, then if around them NPCs having problems with failed jumps that doesn't feel contrived.
The other thing you can do as a Star Wars pirate is rob systems where there is significant in system real space travel between mining facilities in the outer solar system and highly populated colony/refinery worlds in the inner solar system. That traverse can take several hours to half a day and an in system hyperspace jump can be too risky to make it worthwhile, which means a pirate can ambush ships in the middle of the transit away from places authorities are most likely to be loitering. Hypermatter and strange matter and other exotic types of matter is the "gold dubloons" of the Star Wars universe, with cargos that can be really valuable relative to the size of the cargo.