We will arrive Kansai in the evening around 21:05.Considering customs/immigration, will we have trouble getting to Osaka or Kyoto?For Kyoto City, you may miss the last connection of the day.
Unless the immigration procedure extraordinarily takes long time,
you can get to Osaka City, I think.
According to the current timetables,
the last JR direct train for Osaka (Umeda area)
is Airport Rapid
which departs at 23:09 and arrives to Osaka at 00:14,
and the last Nankai direct train for Namba
is Airport Express
which departs at 23:55 and arrives to Namba at 00:39.
Unlike JR Haruka and Nankai Rapi:t,
these slower trains are not designed specifically for airway users.
The last JR Haruka departs at 22:16.
The last Nankai Rapi:t departs either at 22:55 or at 23:00.
When you go by JR for Osaka City,
note that Osaka Station is not the last stop.
("Osaka" and "Kyoto" each may refer to the prefecture.)
- Japan Guide: How to travel between KIX and Osaka City
https://www.japan-guide.com/e/e4006.html?aFROM=2033_2157- Japan Guide: How to travel between KIX and Kyoto City
https://www.japan-guide.com/e/e2363.html?aFROM=2033_2158