Sort by node or comment
If you were building the SQL directly, you could do it in the ORDER BY clause with the CASE WHEN syntax where you do something like:

CASE WHEN comment_table.timestamp &gt; node_table.timestamp then comment_table.timestamp else node_table.timestamp

Since there is no default Views core plugin for CASE WHEN sorting, you can either build a Views sort plugin that implements the syntax or use existing plugins that allow custom SQL with a notable security caveat that comes with storing code in your configuration.