Before I moved houses recently to be closer to uni, I travelled 2 hours each way to university. I found that the type of work I was doing and the mode of transport greatly influenced my effectiveness.
On the V/Line, I could watch lectures, complete assignments, write notes, and do questions that didn't involve maths as using paper is finnicky. My train time was before and after peak period so it wasn't very crowded. If it was crowded, then sometimes I couldn't get out my laptop as I was standing, so all I could do were flashcards I had on my phone (using Anki). If I was using a Metro train, which tends to be a bit more uncomfortable, I don't think I could have done this as easily.
For buses, I found the only work I could do were flashcards on my phone. I wouldn't have been able to do anything else, even lectures.
Ultimately, it can be done but just note that it won't be as effective study as at a desk, so like AngelWings said I wouldn't rely on it. Besides, public transport can be really draining, it's also okay to simply use that to rest sometimes!
Best of luck 🐢