I found there to be very odd spacing when using a math macro just before a binary operation. Here is a minimal example:
\documentclass[11pt]{article}
\usepackage{amsmath}
\DeclareMathOperator{\id}{id}
\begin{document}
$x\otimes \id$
$\id \otimes x$
\end{document}
produces

I am aware that sometimes a macro "eats up" the space after it, requiring that we put it in braces or put a \ after it, but I wouldn't have expected the space after the operation to be what is affected. Can someone explain what is going on, and how I could set this up differently so that the spacing will turn out correctly?

\newcommand{\id}{\mathop{\mathrm{id}}\mathopen{}\mathord{}}, see e.g. https://tex.stackexchange.com/a/16699 – Watson Jan 08 '21 at 17:15