Yes you can alternate them.
Be aware that over developing your pushing muscles will make your neck worse.
If you're doing pushups you need to inverted rows. If you're dips you need to do chins
Then you have balance.
But pushups and dips are working the same muscle, your triceps.
They work more than your triceps