If I wanted to explore some other countries by train from Kraków, what countries are easily accessed? I seem to recall it can be quite difficult/take a long time to get from Poland to Ukraine by train.
This depends on what you mean by a long time and precisely which country you are interested in. Fortunately the Man in Seat 16 has already done the research for you.
So you have a choice of two day-time trains a day from Krakóv to Lviv and Kyiv in Ukraine if that is your specific destination. There is also a sleeper from Warsaw.