Messing with several versions of drush When I run
drush --version

I get next output:
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
 Drush Version   :  7.4.0 

For getting rid of the warning, I have been told I to install drush version 8.
So I issued:
composer require drush/drush:8

giving next result:
./composer.json has been updated
Running composer update drush/drush
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

So I suppose drush was already at version 8, but issuing the command above, I still have the same result: version 7.4.0. I am probably messing with several versions of drush.
I would like to understand better how to get rid of the old version, and being sure I am using the last one.
You are mixing up the globally installed Drush with a locally installed Drush. To run the local Drush from your project, run vendor/drush/drush/drush --version from inside your project. This will give you 8.0.0 which is a bit old. Better get the latest Drush 8 release with composer require drush/drush:^8. Currently this is Drush 8.4.8.
Next, you can consider to either update the globally installed Drush (not recommended) composer global require drush/drush:^8 or alternatively (recommended) install the Drush Launcher instead. The Drush Launcher is just a wrapper command to always pick up the project-local Drush. So you can easily run Composer-based D7 and D8/D8+ projects on the same machine in parallel and calling drush --version in a project will adjust accordingly.
If your project is D8 or D9 install Drush 10 instead composer require drush/drush.