The error messages mean the Spark driver is having insufficient resources. Although increasing the driver memory or using a bigger instance type is a quick workaround, identifying the issue is the key thing.
On the application side , review if there are operations which is driver intensive. Say, collect() or toPandas() etc.
Also check if the instance type used is adequate for the workload.