Why do character counts differ?
A visible character can contain several Unicode code points. The large count uses grapheme clusters, so a joined emoji or an accented letter can count as one. Without whitespace removes spaces, including tabs and line breaks.
A worked example
Octopus 🐙 has 9 visible characters and 8 without whitespace. It uses 12 UTF-8 bytes and 10 UTF-16 code units.
Before you use the result
Apps set their own limits. Some count bytes or code units instead of visible characters. Use the matching count when a platform tells you how its limit works. For a word limit instead, count the words.