Ubud is around 35km north of Kuta Beach, or 30km north of Sanur.
Public transport between the beaches and Ubud is difficult because all public transport stops at the Batubulan Terminal on the northern outskirts of Denpasar.
To get to Kuta from there you also need to change bemo at Tegal Terminal, or to Sanur the change is at Kereneng Terminal. Far easier is a shuttle bus for tourists run by one of the tour companies in Ubud along Jalan Raya Ubud, or Jalan Monkey Forest.
Allow 1 – 2 hours for the trip, and even longer if going to the airport.
Travel Agents & Car Rental in Ubud
Perama Bus Ubud Jln Raya Padangtegal, Pengesokan (south of Monkey Forest)
Tel. 361 973 316
Bali Goro Jln Raya, Ubud
Mumbul Tour Jln Raya, Ubud
Nomad Car Hire Jln Raya, Ubud
Gusti ‘s Jln Raya, Ubud
Purpa Car Jln Raya, Ubud
Bali Coach Tour & Freight Jln Monkey Forest, Ubud
https://balijavapocketguide.com/bali-to-yogyakarta-by-bus/