I saw that ford will stop selling sedans. I'm about to buy a 2018 ford fusion hybrid. Will the vehicle still be covered under warranty and in case of an accident will there be parts available?
I wouldn't worry about this - car companies stop producing car lines all the time. When a company makes big changes to a car line, moving from one generation to another it's essentially stopping one line and producing another from a support point of view. When they make these changes they always honor their warranties because 1) it's the law (at least in the US) and 2) it would damage their reputation if they didn't.
As for how long parts will be available again it's the same as any other time they change a body shape or make big alterations to a model: some parts will be around for a long time, and others may become harder to find. Many parts are used on a wide range of cars: brakes, starter motors, computers, electronics, bearings, and lots of others will be extremely common with many options for aftermarket upgrades or modifications.
Parts individual to a model, like body and interior panels and trim will not generally be interchangeable with other cars, so will become rarer over time, but again that's the same as any other car after the manufacturer makes big changes to the model.