Caution: the following discussion assumes that the package amsmath has been loaded.
In general \mathrm should be used for "symbols" and \text for, yes, text. :)
However, it's best to use operators for clusters of Roman letters that represent functions: the commands \lcm and \gcd are predefined; for "ord" there's not a predefined command, but it suffices to put in the preamble
\DeclareMathOperator{\ord}{ord}
(the command's name can be what one wants). The input before would become
\frac{\lcm(m,n)}{\gcd(m,n)}
\quad \text{divides} \quad
\frac{\lcm(m,n)}{|\langle x\rangle\cap\langle y\rangle|}
\quad \text{divides} \quad
\ord(ab)
\quad \text{divides} \quad
\lcm(m,n)
In this case \text{divides} and \mathrm{divides} might give the same result, but they are conceptually different (and can actually be printed in different ways, depending on the math fonts used). Spaces in the argument of \mathrm are ignored, for example. Moreover, \text honors the font of the surrounding environment: it will print in italics in the statement of a theorem.
Particular attention should be paid to units such as "m/s"; it's best not to do them "by hand", but employ a package like siunitx that takes care of all the subtleties, while being very flexible.
\text{ ... }-- it's easier to see that they're present when you do that. – barbara beeton May 31 '11 at 12:34\text{divides}and\mathrm{divides}are not always the same. Usingunicode-mathwith OpenType math fonts, the math alphabets come from the math font instead of the text fonts, by default. Anyway, it is a good answer and I voted it up -:) – Yan Zhou Jun 18 '11 at 10:31siunitxin your answer to typeset numbers and/or units as a third kind of text (operators, units, text). Which are also often set with\mathrm{m}/\mathrm{s}instead of\si{\meter\per\second}, which I prefer becuase it’s more flexible and able to be changed globally. – Tobi Jun 18 '11 at 11:07\text{ divides }to\quad \text{divides} \quad. The former gives it a more "text-like" spacing. – kahen Feb 28 '13 at 22:48\mathrmis, that you "can't" use accentes, like umlauts (in principle, you can, but you will get warnings about…is invalid in math-mode) – Henri Menke Jan 05 '14 at 10:01\DeclareMathOperator\Aut{Aut}or\newcommand\Aut{\mathrm{Aut}}? – Gaussler May 22 '16 at 19:15\mathrm? – Gaussler May 22 '16 at 19:36unicode-mathis\symupacceptable for math mode text, as in text sub/superscripts? – LaTeXereXeTaL Nov 23 '20 at 01:06mathrminstead oftext? (Assuming units packages aren't available) – endolith Feb 16 '21 at 16:25mathematical sense. – starbeamrainbowlabs Nov 25 '23 at 21:53Symbolshere. – starbeamrainbowlabs Nov 25 '23 at 23:25