Border crossings can be good for hitchhiking. Cars have to stop and if you successfully make it to the next country you can easily hitch a ride going far towards your destination. Generally people are much more likely to pick you up after you crossed the border yourself.
In some places, such as some crossings in Turkey and New York State, they don't like people walking across the border. It's mostly better to get a ride across the border and get out there if humanly possible (if there are e.g. money exchange offices).
At all times keep your bag with you when leaving your car. You might be sent back to the country you came for, or other bad scenarios could happen.
If you are entering a country you need a visa for and just plan to transit, it could be wise not to tell your plans to the boarder guards, but instead tell them you are visiting a city in the country itself.
n0id and M. did tell the border guard when leaving Moldova and entering Ukraine that they were headed for Poland. When asked at which border crossing they would enter Poland they unknowingly told the first which crossed their mind - the one they had taken before. Unfortunately, the border guard put a transit stamp with the name of the border crossing in their passports which later determined which way they had to take.