The common advice that you shouldn't play against a computer has a few facets.
It is true that chess AIs play differently from humans, not because they cannot play like humans but because most of their designers are concerned with winning rather than losing like humans. So if you play against an AI, you would usually see a different distribution of responses to your play than against humans. In particular, the AI is unlikely to make the same variety of mistakes that humans make, so you lose out a bit in learning how to punish such mistakes. Also, the AI is unlikely to take safe solid winning routes, since if they can see an ad hoc 10-move-deep tactic that gets a better result they will take it over a slow-and-steady endgame-win, so you would also lose out in such understanding.
That said, it is a general truth that one of the fastest ways to learn to play a strategy game is to keep playing against a player that is slightly better than yourself (this has even been mentioned before on Chess SE). If you do precisely this, it is possible to learn quite fast whether or not your training opponent is human. After all, even the Lichess AI is designed to make some amount of mistakes, so if you are able to punish these then you would also be able to punish human mistakes.
The biggest problem with playing against an engine is that you must be proactive in identifying and learning from your mistakes, playing out alternative lines against the computer to figure out where you went wrong and what you could have done instead. If you cannot understand why a move is a mistake because the tactic involved seems too deep, it may have been an issue in the past if you do not have a hired trainer, but not in modern times since you can ask on Chess SE...