I use this technique: How to Scribe for a Perfect Fit | The Family Handyman
If I'm putting a piece of plywood perpendicular to the wall (for the side of a full height closet, for instance) I start with a piece of plywood the right height and a couple inches wider than it needs to be, but with a very roughly cut "curve" in it. Make those cuts with a circular saw.
Then move the plywood into the bus and position it as close to the wall as you can. The article I posted shows a pencil in a compass. I don't have one so I tape a pencil to a chunk of 1"x4" and use that.
Hold the tape+wood chunk against the wall - keeping it level - and draw the shape of the wall onto the plywood.
Notice how I mentioned to cut the piece several inches wider than it needs to be? When you cut along the curved line you just made the piece of plywood should be closer to the correct width. Trim the straight side to make it the perfect width.