The ban issue becomes crystal clear when you consider the two cases separately. Let's walk through it.

Single-player modding

Mods that affect single-player only (texture swaps, custom maps, MLOs added in SP) have generally not led to bans since the 2017 OpenIV rollback.

Risk: negligible, if you avoid online play entirely.

Online modding

Aggressively enforced. Cheating tools, aimbots, money glitches and modded gameplay in multiplayer sessions can all get you banned.

Risk: high. Keep single-player mods out of your online games.

The grey zone

Some mods change game files in ways that impact both single-player and online behaviour. Best practice is to make sure your modded install never touches online play. Some players have a clean install for online play and a modded install for single-player.