Passing on a double yellow line is dangerous and illegal in most jurisdictions. It is especially dangerous when there is oncoming traffic, as you may not have enough time to avoid a collision.
If you are behind a car that is driving recklessly, the best thing to do is to slow down and maintain a safe following distance. You can also try to signal to the driver to pull over, or if you witness them committing serious violations, you may choose to call the police.