I'm French, I live in France and I'm considering applying for a remote job in a US company. Are there any legal issues that would prevent me to do so? How would the time spent working in a US company affect my future retirement plan? What about the things any French employer contributes to such as "la sécurité sociale"? Can I lose some benefits in France by paying my taxes to the US? Are there any tricky things I should know about this situation?
The whole situation is quite tricky. Hiring an employee in France comes with a bunch of obligations for the employer including contributions to the sécurité sociale and generally following local employment law, which is not trivial if you are not familiar with it. If the employer is not able to set up payroll in France then you would obviously lose employment-related benefits (retirement pension, healthcare, unemployment insurance) but that's only the beginning of your problems.
Being hired by a US company doesn't per se exempt you or your employer from any obligation — from taxes and mandatory contributions to working times and many other details of the working conditions. If you are in France, they still apply to you (otherwise many employers would set up a business in, say, Cyprus or Malta to sidestep French law entirely) as does income tax (unless you fall in a situation covered by a bilateral tax treaty).
Some employers offer to hire you as a contractor instead (thus offloading the administrative burden on you) but that's very questionable under French law if they actually treat you like an employee. Consequently, some remote-only businesses like Gitlab go through a local legal entity that can offer a bona fide employment contract but hiring in France seems to be paused at the moment.