Rigidbody trying to follow a spline with smoothing

Hello, i am working on a spaceship race game that the player and another spaceship are racing, the game has checkpoints that you have to pass to continue to the next one. i am currently moving the spaceship with raycast casting and letting it decide where to steer depending on the position of the spaceship relative to the tracks width BUT this results to a large code and a not so realistic movement. i want to use splines but not just to follow the spline, i want to make the spaceship trying to follow the spline and depending on the force that has or if the player pushes it the spaceship to get of course and try to smoothly get back on course.
thank you

@AndreasMon My best advice would be to buy one of the racing assets on unity and have a look at their code to see how they did it, thats what I did to make the ai for my racing game. Its pretty advanced coding making ai for racing games. The way I would approach it is to have the ai move towards points along a track with some randomness to their movements whilst raycasting to avoid the player and make sure they stay in the width of the track.