Further research revealed that this is a known issue with Slack in XFCE, since Slack does not properly expose its icon to the windows manager. The workaround is to set the icon manually using xseticon. The links below detail the problem and the fix. In my case, it involved writing a script that ran after Slack opened and set the icon properly. A highly simplified version looks like this one from one of the mentioned links:
function change-panel-icon {
sleep $WAIT
activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
activeWinId="${activeWinLine:40}"
xseticon -id "$activeWinId" "$ICON"
}
$APP & change-panel-icon
The Spotify app has a similar issue, and it sounds like some other Electron apps do as well. Hopefully this will be fixed in a future XFWM release.
XFCE (Xubuntu) Alt-Tab switcher: missing app icons - Ask Ubuntu
XFCE (Xubuntu) Alt-Tab switcher: missing app icons
Missing icon and app/window not present in application switcher · Issue #37 · flathub/com.slack.Slack · GitHub
https://github.com/flathub/com.slack.Slack/issues/37
[SOLVED] Applications to the right and Slack icon problem / Desktop / Xfce Forums
https://forum.xfce.org/viewtopic.php?id=13149
Customize icon app on panel running apps and workspace ? / Desktop / Xfce Forums
https://forum.xfce.org/viewtopic.php?pid=45963#p45963
15510 – Icons for slack "desktop" application not visible in the window decoration and the task switcher
https://bugzilla.xfce.org/show_bug.cgi?id=15510
Slack snap - window has no icon - snap - snapcraft.io
https://forum.snapcraft.io/t/slack-snap-window-has-no-icon/3589/40