In my opinion trains are nice but they will sometimes drop you off in the middle of nowhere so be prepared to hitch as a back up. That and big city yards tend to be located in some of the absolute sketchiest neighborhoods in this country. I thought I would be "safer" hopping freight alone until I got dropped off in the Memphis yard in the middle of the night, not knowing that it was in the top five for most violent cities in America. There were cars full of thugs following me at a snail's pace underneath the freeways where there was pretty much nobody around so I wouldn't recommend doing that solo.
And as for defending yourself, pepper spray is good but obviously not in a car. Be prepared to grab the wheel if necessary. I never had to do that but do have friends that have. Also, try not to sleep in anyone's car if you can help it. I hitched with another girl for years and, in the US at least, we never really had any major problems. Our pattern was to hitch during the daylight hours and then get out at night to sleep, no matter where we were or what the weather was. There were some exceptions but only on a very select basis. Hitching during the day will also eliminate the vast majority of tweekers, drunks and other people that are a bit off for whatever reason or just shouldn't be driving. We are both assertive people and would almost always refuse offers to go back to people's houses or go off the route we were headed. It's best to be as self-sufficient as possible and you will get places in a hurry that way too. So always have a sleeping bag and travel with someone who is independent enough not to get suckered into shady situations. It might not be a bad idea to also have a little money on hand for a bus ticket in case you get separated.