States Borders
First off, most Canadian or American states' borders are not particularly straight. Even when they are supposed to be straight, there are often nooks and crannies.
But indeed there's a tendency to use simple straight borders when creating a territorial entity from scratch, especially on the basis of longitude and latitudes. We see this in many colonial borders, in America or elsewhere in the various European empires. Due to the way map are usually drawn, this often ends up looking like straight lines.
The advantages for doing so are obvious. Decision makers did not often have much details on local geographic features when portioning remote territorial claims into colonies. Even if they did, basing borders on geography was prone to create disputes. The inaccuracy of surveys aside, the natural twists and turns of geographic features, especially rivers (which to make matters worse may change course) are source of major headaches.
For instance, the recently settled long standing dispute between Maine and New Hampshire over islands in the Piscataqua River that forms their borders; Alabama and Georgia's dispute over their Chattahoochee River border; or Georgia and South Carolina's dispute at the Savannah River and its islands.
In contrast, there is only one 42nd parallel (incidentally part of the border between New York and Pennsylvania, which is fixed, simple, and objectively determinable.
Canadian-US Border
This border in particular seems straight because a huge 3,500 km section of the Canadian-US border was somewhat arbitrarily fixed at the 49th parallel. Most of the border west of the Lake of the Woods was first proposed in 1807, and decided in the Anglo-American Convention of 1818, with the Oregon section finalised in the Oregon Treaty.
The 49th parallel had formerly been proposed by Britain as a formal border with French Louisiana as early as the 1713 Treaty of Utrecht. This was revived after Louisiana was purchased as a satisfactory border for both. At the time Louisiana claims include the entirety of the Mississippi's western watershed, while Britain claimed the all of Hudson's Bay drainage basin. Both extended north and south of the 49th parallel, respectively. Setting the border this was, in an appealingly simple (on paper) straight line, was thus an acceptable compromise for both nations.
Most of Alaska's border with Canada was inherited from Russian times. It looks straight because most of it were fixed at the 141st meridian west under the Anglo-Russian Convention of 1825.
Multiple wars might eventually readjust the border to more natural terrain features. However, the reality is that the United States had not fought any war against Canada (or British North America) since the borders were demarcated. Consequently, the border remained as it was drawn when the land was largely devoid of European settlements.
Lastly, if you look closely at the border, there is nothing straight about the Canadian-US border east of the Lake of the Woods.