The documentation on is_page(), when you scroll down, has some great examples of how to use it:
// When any single Page is being displayed.
// When Page 42 (ID) is being displayed.
You're getting the Fatal Error because array_diff() is comparing the WP_Term objects in your array to a string, and it can't do that. Here's one way to fix that:
$topic = array_diff($topic, [&...